GOPRIVATE private modules

What is the recommended configuration for pulling in private go modules?

In other pipeline jobs, we configure something like:

  - before_script:
    - go env -w "GOPRIVATE=${CI_SERVER_HOST}"
    - echo -e "machine ${CI_SERVER_HOST} login gitlab-ci-token password ${CI_JOB_TOKEN}" > ~/.netrc

References:

https://go.dev/ref/mod#private-module-proxy-direct https://go.dev/ref/mod#private-module-repo-auth