Support Forums

Guidance on GO_IMPORT_PATH for the Quick-Deploy Template

In my netlify.toml, I have the environment variable assignment:

    GO_IMPORT_PATH = "github.com/shrmpy/pavlok"

I considered changing this to be a field that the user can configure by moving it in the [template.environment] section. However, that doesn’t seem correct because at the time of Quick-Deploy, the repository is being created for the user. The user won’t know the name of the new repository.

  • netlify site name: quizzical-brahmagupta-7af31f.netlify.app

Hi @shrmpy,

You can try using the REPOSITORY_URL variable:

It might look like $REPOSITORY_URL, but I’m not sure if it will work.

Thank you, the REPOSITORY_URL was a good clue. That led me to the documentation about Inject env var

  • Since I use a Makefile for the build command, I tried prefixing GO_IMPORT_PATH=${REPOSITORY_URL} to the line. The deploy preview was successful. Except what was interesting was the build-time value showed the format git@github.com:shrmpy/project. This made me curious whether the environment variable is optional.
  • Then I tried skipping the GO_IMPORT_PATH from both netlify.toml and Makefile. The deploy preview was still successful.
  • So from that I merged and tried a second git account for the Quick-Deploy test. It was successful!

I guess I don’t need this env var in this configuration, or the guide I followed used it in a older setup (maybe closer to Go 1.11 versions when modules were introduced?)

1 Like