Skip to content

Commit

Permalink
Ensure default GOBIN is relative to GOPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
doesdev committed Apr 15, 2018
1 parent 0763a07 commit 699fce9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const exists = require('fs').existsSync
const vendor = path.resolve(__dirname, 'vendor')
const defGoRoot = path.join(vendor, 'go')
const defGoPath = path.join(vendor, 'gopath')
const defGoBin = path.join(defGoPath, 'bin')
const cpu64 = (process.env.PROCESSOR_ARCHITECTURE || '').indexOf('64') !== -1
const arch = (cpu64 || process.arch.indexOf('64') !== -1) ? 'amd64' : '386'

Expand All @@ -18,7 +17,7 @@ module.exports = (opts = {}) => {
if (opts.useLocal) goRoot = defGoRoot
env.GOROOT = goRoot = goRoot || env.GOROOT || defGoRoot
env.GOPATH = goPath = goPath || env.GOPATH || defGoPath
env.GOBIN = goBin = goBin || env.GOBIN || defGoBin
env.GOBIN = goBin = goBin || env.GOBIN || path.join(goPath, 'bin')
env.GOARCH = goArch = goArch || env.GOARCH || arch
env.ngoBin = path.join(goRoot, 'bin', 'go')
try { env.hasBin = exists(path.join(goRoot, 'bin')) } catch (ex) {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngo",
"version": "2.4.7",
"version": "2.4.8",
"description": "Run Go commands from Node or CLI, Go env not required",
"engines": {
"node": ">=6.0.0"
Expand Down

0 comments on commit 699fce9

Please sign in to comment.