Skip to content

function61/buildkit-golang

Build status Download

Golang buildkit with shared low-level tools / build process required for Go projects of some quality.

See Turbo Bob for more details.

How to use

build-go-project.sh is available inside the container image.

Our typical projects declare the build-go-project.sh call in the build command definition in turbobob.json.

Cross compilation is done depending on ENV variables. E.g. to build for Linux/ARM you should have BUILD_LINUX_ARM=true set. These are handled automatically if you use Turbo Bob.

Features

  • Go build environment
  • Contains goimports which is like gofmt for your imports - it can sometimes even automatically add missing imports!
  • Contains gopls, a Go language server. Works in a container without changes to one's host system!
    • Working is somewhat tied to use with Turbo Bob (LSP working inside container needs a few tricks)
  • Contains Gohack to make editing dependency modules easy
  • Fully static builds (so works even on Alpine linux which doesn't have standard libc)
  • Cross compilation support:
    • Linux-amd64
    • Linux-arm
    • Windows-amd64
    • macOS-amd64
  • Protobuf compiler included
  • Deployer integration
    • For packaging deployerspec.zip files
  • doc2go for generating documentation (use case: private documentation). See why godoc isn't enough.

Standardized build process:

  • Passes build version to your code
  • Runs static analysis
  • Runs your unit tests ($ go test)
    • With race detector enabled
  • Fetches your dependencies using Go modules
  • Automatically rejects Go code that is not $ go fmt'd
  • Runs any code generators you might have
    • Runs $ go generate ./...
  • Helper for packaging your binary as Lambda function
  • Provides custom hooks between build steps if you have something special (though this might be a smell)

About

Frequently needed tools for building Golang-based projects

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks