https://github.com/buildkite-plugins/gopath-checkout-buildkite-plugin
⛺️ Setup your GOPATH and checkout directory for running Go commands
https://github.com/buildkite-plugins/gopath-checkout-buildkite-plugin
buildkite buildkite-plugin elastic-stack-supported golang hosted-linux-supported hosted-mac-supported
Last synced: 2 months ago
JSON representation
⛺️ Setup your GOPATH and checkout directory for running Go commands
- Host: GitHub
- URL: https://github.com/buildkite-plugins/gopath-checkout-buildkite-plugin
- Owner: buildkite-plugins
- License: mit
- Created: 2017-02-17T04:18:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-05-30T13:29:42.000Z (about 1 year ago)
- Last Synced: 2025-05-30T18:42:03.513Z (about 1 year ago)
- Topics: buildkite, buildkite-plugin, elastic-stack-supported, golang, hosted-linux-supported, hosted-mac-supported
- Language: Shell
- Homepage:
- Size: 98.6 KB
- Stars: 5
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# GOPATH Checkout Buildkite Plugin [](https://buildkite.com/buildkite/plugins-gopath-checkout)
A [Buildkite plugin](https://buildkite.com/docs/agent/v3/plugins) for running [Go](https://golang.org) code directly on your agent machines. It does this by setting the `$GOPATH`, and checking out your project into the correct directory structure.
See also the [golang-build plugin](https://github.com/buildkite-plugins/golang-build-buildkite-plugin).
## Example
The following pipeline will ensure the project is checked out into the correct `$GOPATH/src` directory before running the `go test` command:
```yml
steps:
- command: go test
plugins:
- gopath-checkout#v2.0.0:
import: github.com/my-org/my-project
```
## Configuration
### `import`
The import path to use when the project is checked out. For example, if you develop in `$GOPATH/src/github.com/my-org/my-project` then the `import` option should be `github.com/my-org/my-project`.
## Compatibility
| Elastic Stack | Agent Stack K8s | Hosted (Mac) | Hosted (Linux) | Notes |
| :-----------: | :-------------: | :----: | :----: |:---- |
| ✅ | ❌ | ✅ | ✅ | **K8s** Uses `pre-checkout` hook, which runs in separate `checkout` container from commands |
- ✅ Fully supported (all combinations of attributes have been tested to pass)
- ⚠️ Partially supported (some combinations cause errors/issues)
- ❌ Not supported
## Developing
To run testing, shellchecks and plugin linting use use `bk run` with the [Buildkite CLI](https://github.com/buildkite/cli).
```bash
bk run
```
Or if you want to run just the tests, you can use the docker [Plugin Tester](https://github.com/buildkite-plugins/buildkite-plugin-tester):
```bash
docker run --rm -ti -v "${PWD}":/plugin buildkite/plugin-tester:latest
```
## Roadmap
* Prepend to existing `$GOPATH`s instead of replacing
## License
MIT (see [LICENSE](LICENSE))