This is a creation in Article, where the information may have evolved or changed.
GB Introduction
- site:https://getgb.io/
- Github:https://github.com/constabula ...
Homepage Introduction
A project based build tool for the Go programming language.
So GB is a build tool that relies on the management plug-in to complete the Gb-vendor
Doc
Why use GB, the favorite point is Project based workflow based on project
Bashd, notGOPATH bashd
The project does not need to be GOPATH under
Project structure
Two important directories
- $ project/src/our own code of business
- $ project/vendor/src/third-party dependence in this
For example, a named redeem project, project structure
.├── README.md├── bin│ └── redeem├── src│ └── redeem│ └── main.go└── vendor ├── manifest └── src ├── github.com └── gopkg.in
Use GB vendor to process dependencies, such as
$ gb vendor fetch github.com/urfave/cli
Gitlab CI
It's also easy to build in Gopath using go build, I'm Gitlab ci
That's how it's handled.
The build project on Gitlab CI usesimage: golang:latest
The GB tool is not installed and can be used directlygo build
Only need to put the dependency on /vendor/src src/redeem/vendor , Gopath set the
GOPATH: $CI_PROJECT_DIR
such as before_script: part
Image:golang:latestvariables:GOPATH: $CI _project_dirbefore_script:-MV vendor/src/* src/redeem/vendor/- CD src/redeemstages:-test-buildformat:stage:test script:-Go FMT $ (go list./... | grep-v/vendo r/)-Go vet $ (go list./... | grep-v/vendor/)-Go test-race $ (go list .../... | grep-v/vendor/) Compile: Stage:build script:-Goos=darwin goarch=amd64 go build-o $CI _project_dir/redeem_mac-goos=windows GOARCH= AMD64 go build-o $CI _project_dir/redeem_win artifacts:paths:-Redeem_mac-redeem_win