aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/golang.js
diff options
context:
space:
mode:
authorAustin Morton <austinpmorton@gmail.com>2020-11-03 07:32:52 -0500
committerAustin Morton <austinpmorton@gmail.com>2020-11-03 07:32:52 -0500
commit4b869071fd71af704c1261c3e649d014053a5575 (patch)
treec95dd85c92861d54c29e4012eb8c854fc40fbe20 /lib/compilers/golang.js
parent64003156508ce4cf610a24039f87b4ce8fba275a (diff)
downloadcompiler-explorer-4b869071fd71af704c1261c3e649d014053a5575.tar.gz
compiler-explorer-4b869071fd71af704c1261c3e649d014053a5575.zip
Fix golang compiler output when run under firejail
Due to some environment differences between running under firejail or under no sandbox, the regex used in `extractLogging` does not match any lines because the compiler output already has filenames replaced with `<source>` when run under firejail. When run outside firejail the filenames are not filtered. Additionally, some compiler output was lost due to having a filename of `<autogenerated>`. Fixes #2228
Diffstat (limited to 'lib/compilers/golang.js')
-rw-r--r--lib/compilers/golang.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js
index 423030500..73a64aac7 100644
--- a/lib/compilers/golang.js
+++ b/lib/compilers/golang.js
@@ -169,7 +169,7 @@ export class GolangCompiler extends BaseCompiler {
extractLogging(stdout) {
let filepath = `./${this.compileFilename}`;
- const reLogging = new RegExp(`^${filepath}:([0-9]*):([0-9]*):\\s(.*)`, 'i');
+ const reLogging = /^[^:]+:\d+:(\d+:)?\s.*/;
return stdout.filter(obj => obj.text.match(reLogging))
.map(obj => obj.text.replace(filepath, '<source>'))
.join('\n');
@@ -201,7 +201,7 @@ export class GolangCompiler extends BaseCompiler {
return ['build', '-o', outputFilename, '-gcflags=' + userOptions.join(' ')];
} else {
// Add userOptions to -gcflags to preserve previous behavior.
- return ['build', '-o', outputFilename, '-gcflags', '-S ' + userOptions.join(' ')];
+ return ['build', '-o', outputFilename, '-gcflags=-S ' + userOptions.join(' ')];
}
}