| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Run Go commands from Node or CLI, Go env not required
Will download latest binaries locally if Go isn't already in PATH
If you run a command and it fails with "cannot find package..." we'll try to install said package(s). YAYS. 😌
$ npm install --save ngo$ npm install --global ngo$ ngo version
# go version go1.8.3 windows/amd64
# to update the `ngo` install of Go (won't update system version)
$ ngo-update
# go version go1.9.4 windows/amd64
# to set the `ngo` install of Go to a specific version (won't update system version)
$ ngo-version 1.12.0
# go version go1.12.0 windows/amd64
# to run a `go get` installed binary use this bs
$ ngo-binary golint test/fixtures/errors.go
# test\fixtures\errors.go:13:5: error var unexp should have name of the form errFooreturns promise that resolves to execa style object without the child_process goodies
const goOpts = {}
const ngo = require('ngo')(goOpts)
const golint = ngo.bin('golint')
ngo('version').then(console.log).catch(console.error)
/* {
stdout: 'go version go1.8.3 windows/amd64',
stderr: '',
code: 0,
failed: false,
killed: false,
signal: null,
cmd: 'C:\\Go\\bin\\go version'
} */
golint('main.go').then(console.log).catch(console.error)this is a copy of ngo's process.env with the Go environment variables added to it
MIT © Andrew Carpenter
| Back | FazBrowse Home | New Git URL |