{"id":20962977,"url":"https://github.com/doesdev/ngo","last_synced_at":"2025-05-14T08:34:41.764Z","repository":{"id":65424527,"uuid":"73594966","full_name":"doesdev/ngo","owner":"doesdev","description":"Run Go commands from Node or CLI, Go env not required","archived":false,"fork":false,"pushed_at":"2023-06-29T10:49:47.000Z","size":169,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-21T21:22:38.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doesdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-13T04:15:38.000Z","updated_at":"2023-03-08T04:46:28.000Z","dependencies_parsed_at":"2024-06-19T17:10:44.207Z","dependency_job_id":"bc14be62-5eb4-493b-b26b-5238ecf612a9","html_url":"https://github.com/doesdev/ngo","commit_stats":{"total_commits":60,"total_committers":2,"mean_commits":30.0,"dds":0.01666666666666672,"last_synced_commit":"2174ca8a8a05724d5f6de8804e11d1aa07c34515"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Fngo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Fngo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Fngo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doesdev%2Fngo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doesdev","download_url":"https://codeload.github.com/doesdev/ngo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254105134,"owners_count":22015597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T02:39:42.206Z","updated_at":"2025-05-14T08:34:41.497Z","avatar_url":"https://github.com/doesdev.png","language":"JavaScript","readme":"# ngo [![NPM version](https://badge.fury.io/js/ngo.svg)](https://npmjs.org/package/ngo)   [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)   [![Dependency Status](https://dependencyci.com/github/doesdev/ngo/badge)](https://dependencyci.com/github/doesdev/ngo)   [![Build status](https://ci.appveyor.com/api/projects/status/0wutjytsl4hmha1j?svg=true)](https://ci.appveyor.com/project/doesdev/ngo)   [![Build Status](https://travis-ci.org/doesdev/ngo.svg)](https://travis-ci.org/doesdev/ngo)   \n\n\u003e Run Go commands from Node or CLI, Go env not required\n\nWill download latest binaries locally if Go isn't already in PATH\n\n### BONUS\n\nIf you run a command and it fails with \"cannot find package...\" we'll try to install\nsaid package(s). YAYS. :relieved:\n\n## local install\n\n```sh\n$ npm install --save ngo\n```\n\n## cli install\n\n```sh\n$ npm install --global ngo\n```\n\n## usage\n\n#### cli usage\n```sh\n$ ngo version\n# go version go1.8.3 windows/amd64\n\n# to update the `ngo` install of Go (won't update system version)\n$ ngo-update\n# go version go1.9.4 windows/amd64\n\n# to set the `ngo` install of Go to a specific version (won't update system version)\n$ ngo-version 1.12.0\n# go version go1.12.0 windows/amd64\n\n# to run a `go get` installed binary use this bs\n$ ngo-binary golint test/fixtures/errors.go\n# test\\fixtures\\errors.go:13:5: error var unexp should have name of the form errFoo\n```\n\n#### programmatic usage\nreturns promise that resolves to `execa` style object without the `child_process` goodies\n\n```js\nconst goOpts = {}\nconst ngo = require('ngo')(goOpts)\nconst golint = ngo.bin('golint')\n\nngo('version').then(console.log).catch(console.error)\n/* {\n stdout: 'go version go1.8.3 windows/amd64',\n stderr: '',\n code: 0,\n failed: false,\n killed: false,\n signal: null,\n cmd: 'C:\\\\Go\\\\bin\\\\go version'\n} */\n\ngolint('main.go').then(console.log).catch(console.error)\n```\n\n## api\n\n### const ngo = require('ngo')(`options`)\n- **Purpose:** initialize `ngo`\n- **Arguments:**\n  - **options** *[`Object` - optional]*\n    - **useLocal** *[`Boolean` `false`] - use locally downloaded Go binaries)*\n    - **update** *[`Boolean` `false`] - update local install to latest*\n    - **installDeps** *[`Boolean` `true`] - attempt to install missing packages*\n    - **env** *[`Object`] - environment vars to set for the Go command*\n    - **goRoot** *[`String`] - Go root path (ex. `/usr/local/go`)*\n    - **goPath** *[`String`] - Go workspace path (ex. `~/work`)*\n- **Returns:** `Function` (`ngo`) which executes Go commands\n\n### ngo(`commandArgs`, `options`)\n- **Purpose:** - execute `go` commands\n- **Arguments:**\n  - **commandArgs** *[`Array` | `String` - required] - argument(s) to call with `go` command*\n  - **options** *[`Object` - optional]*\n   - same options as [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)\n   - additonal options available same as [`execa`](https://github.com/sindresorhus/execa#options)\n- **Returns:** `Promise` which resolves to [`execa`](https://github.com/sindresorhus/execa) styled object\n\n### ngo.bin(`binary`)\n- **Purpose:** - execute commands on binaries in the `GOBIN` directory\n- **Arguments:**\n  - **binary** [`String`] - name of binary file to be executed in returned function\n- **Returns:** `Function` (identical to `ngo`, but runs specified binary instead of `go`)\n\n### ngo.env\nthis is a copy of ngo's `process.env` with the Go environment variables added to it\n\n## License\n\nMIT © [Andrew Carpenter](https://github.com/doesdev)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoesdev%2Fngo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoesdev%2Fngo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoesdev%2Fngo/lists"}