devbox icon indicating copy to clipboard operation
devbox copied to clipboard

Inconsistent GOPATH Setting in Devbox Go Examples

Open vn7n24fzkq opened this issue 5 months ago • 0 comments

I'm using Devbox with Go and noticed an inconsistency that might confuse users.

In the documentation example on the website, the GOPATH is set to $PWD:

{
  "packages": [
    "go@latest"
  ],
  "env": {
    "GOPATH": "$PWD",
    "PATH": "$PATH:$PWD/bin"
  },
  "shell": {
    "init_hook": [
      "echo 'Welcome to devbox!' > /dev/null"
    ],
    "scripts": {}
  }
}

However, this differs from the example in the GitHub repository, which sets GOPATH to $HOME/go/: devbox.json

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

I think it would be helpful to align these examples or clarify the intended use cases, as the different GOPATH settings may cause confusion for users setting up their Go environments with Devbox.

Thanks!

vn7n24fzkq avatar Jul 02 '25 08:07 vn7n24fzkq