diff options
author | RabsRincon <rubrinbla@gmail.com> | 2017-11-25 00:44:44 +0100 |
---|---|---|
committer | RabsRincon <rubrinbla@gmail.com> | 2017-11-25 01:02:07 +0100 |
commit | 5d80e83f625a9f02ab892405c292f922bb278d8f (patch) | |
tree | e07afaa4faa0c2c3525d55a7e5b046fe361deaf2 /lib/compilers/golang.js | |
parent | 0c871f36a5f9c7bb5c3efcb8c51b8b296d5b7344 (diff) | |
download | compiler-explorer-5d80e83f625a9f02ab892405c292f922bb278d8f.tar.gz compiler-explorer-5d80e83f625a9f02ab892405c292f922bb278d8f.zip |
Allow older Go versions to run better!
Diffstat (limited to 'lib/compilers/golang.js')
-rw-r--r-- | lib/compilers/golang.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/compilers/golang.js b/lib/compilers/golang.js index 08c30c48d..9469e489c 100644 --- a/lib/compilers/golang.js +++ b/lib/compilers/golang.js @@ -27,6 +27,7 @@ var _ = require('underscore-node'); function compilenewgol(info, env) { var compiler = new Compile(info, env); + compiler.originalGetDefaultExecOptions = compiler.getDefaultExecOptions; function convertNewGoL(code) { var re = /^\s+(0[xX]?[0-9A-Za-z]+)?\s?[0-9]+\s*\(([^:]+):([0-9]+)\)\s*([A-Z]+)(.*)/; @@ -60,6 +61,16 @@ function compilenewgol(info, env) { compiler.optionsForFilter = function (filters, outputFilename, userOptions) { return ['tool', 'compile', '-o', outputFilename, '-S']; }; + + compiler.getDefaultExecOptions = function () { + var execOptions = this.originalGetDefaultExecOptions(); + var goroot = this.env.compilerProps("compiler." + this.compiler.id + ".goroot"); + if (goroot) { + execOptions.env.GOROOT = goroot; + } + return execOptions; + }; + return compiler.initialise(); } |