#74·go

Gopages doesn't propagate environment to subprocesses

Author: erazemkCreated Oct 4, 2024Updated Oct 4, 2024

Hi, I'm trying to set up gopages at work, where we use CircleCI to build and deploy our code. I set up a Makefile that runs gopages with a specific version of Go, which when expanded looks like this:

env GOENV=/Users/erazemk/.../tools/go/go1.23.1/env GOROOT=/Users/erazemk/.../tools/go/go1.23.1/go /Users/erazemk/.../tools/go/go1.23.1/go/bin/go run github.com/johnstarich/go/gopages@latest \
  -out docs \
  -brand-title "<repo>" \
  -brand-description "<repo>" \
  -gh-pages \
  -internal
Generating godoc static pages for module... github.com/<repo>
Committing and pushing changes to gh-pages branch...

When I run this locally, everything works fine, since my system version of go is also up to date. But when running in CircleCI, I get the error:

pipe: pipe: err: exit status 1: stderr: go: go.mod requires go >= 1.22.4 (running go 1.21.5; GOTOOLCHAIN=local)

This makes me think that gopages calls a subprocess, but doesn't also propagate the env.

What can I do to fix this?