aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/golang.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compilers/golang.js')
-rw-r--r--lib/compilers/golang.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js
index edf100e9a..e68eeb904 100644
--- a/lib/compilers/golang.js
+++ b/lib/compilers/golang.js
@@ -41,6 +41,13 @@ export class GolangCompiler extends BaseCompiler {
return 'golang';
}
+ constructor(compilerInfo, env) {
+ super(compilerInfo, env);
+ this.goroot = this.compilerProps(`compiler.${this.compiler.id}.goroot`);
+ this.goarch = this.compilerProps(`compiler.${this.compiler.id}.goarch`);
+ this.goos = this.compilerProps(`compiler.${this.compiler.id}.goos`);
+ }
+
convertNewGoL(code) {
const re = /^\s+(0[Xx]?[\dA-Za-z]+)?\s?(\d+)\s*\(([^:]+):(\d+)\)\s*([A-Z]+)(.*)/;
const reUnknown = /^\s+(0[Xx]?[\dA-Za-z]+)?\s?(\d+)\s*\(<unknown line number>\)\s*([A-Z]+)(.*)/;
@@ -208,17 +215,14 @@ export class GolangCompiler extends BaseCompiler {
getDefaultExecOptions() {
const execOptions = super.getDefaultExecOptions();
- const goroot = this.compilerProps(`compiler.${this.compiler.id}.goroot`);
- if (goroot) {
- execOptions.env.GOROOT = goroot;
+ if (this.goroot) {
+ execOptions.env.GOROOT = this.goroot;
}
- const goarch = this.compilerProps(`compiler.${this.compiler.id}.goarch`);
- if (goarch) {
- execOptions.env.GOARCH = goarch;
+ if (this.goarch) {
+ execOptions.env.GOARCH = this.goarch;
}
- const goos = this.compilerProps(`compiler.${this.compiler.id}.goos`);
- if (goos) {
- execOptions.env.GOOS = goos;
+ if (this.goos) {
+ execOptions.env.GOOS = this.goos;
}
return execOptions;
}