diff options
author | Austin Morton <apmorton@users.noreply.github.com> | 2021-10-05 00:21:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 23:21:32 -0500 |
commit | 810134942d0e8af494d53dceade0054fa5086129 (patch) | |
tree | 9709639486c6c68a1974178c5485f9c4a9af818b /lib/compilers/golang.js | |
parent | a59c3df6535aaf53b8a095d0c664af57764089e5 (diff) | |
download | compiler-explorer-810134942d0e8af494d53dceade0054fa5086129.tar.gz compiler-explorer-810134942d0e8af494d53dceade0054fa5086129.zip |
Avoid calling compilerProps after compiler object construction (#3005)gh-1092
Diffstat (limited to 'lib/compilers/golang.js')
-rw-r--r-- | lib/compilers/golang.js | 22 |
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; } |