{
    "packages": [
        "go@1.19.8"
    ],
    "env": {
        "GOPATH": "$HOME/go/",
        "PATH": "$PATH:$HOME/go/bin"
    },
    "shell": {
        "init_hook": [
            "export \"GOROOT=$(go env GOROOT)\""
        ],
        "scripts": {
            "run_test": "go run main.go"
        }
    }
}

Go

Go projects can be run in Devbox by adding the Go SDK to your project. If your project uses cgo or compiles against C libraries, you should also include them in your packages to ensure Go can compile successfully

Example Repo

Open In Devbox.sh

Adding Go to your Project

devbox add go, or add the following to your devbox.json

  "packages": [
    "go@latest"
  ]

This will install the latest version of the Go SDK. You can find other installable versions of Go by running devbox search go. You can also view the available versions on Nixhub

If you need additional C libraries, you can add them along with gcc to your package list. For example, if libcap is required for your project:

"packages": [
    "go",
    "gcc",
    "libcap"
]
README.md

Level up your dev environment

Checkout the Devbox and Launchpad open-source codebases on Github. Feature requests are always welcome.
Try Devbox Cloud
YOUR INPUT COUNTS

Join the community

Discuss ideas, uses and builds with the Jetpack team and others.