github.com/ahmet2mir/goreleaser@v0.180.3-0.20210927151101-8e5ee5a9b8c5/www/docs/customization/env.md (about)

     1  ---
     2  title: Environment Variables
     3  ---
     4  
     5  Global environment variables to be passed down to all hooks and builds.
     6  
     7  This is useful for `GO111MODULE`, for example. You can have your `.goreleaser.yml` file like the following:
     8  
     9  ```yaml
    10  # .goreleaser.yml
    11  env:
    12    - GO111MODULE=on
    13    - FOO={{ .Env.FOOBAR }}
    14    - ENV_WITH_DEFAULT={{ if index .Env "ENV_WITH_DEFAULT"  }}{{ .Env.ENV_WITH_DEFAULT }}{{ else }}default_value{{ end }}
    15  before:
    16    hooks:
    17      - go mod tidy
    18  builds:
    19  - binary: program
    20  ```
    21  
    22  This way, both `go mod tidy` and the underlying `go build` will have
    23  `GO111MODULE` set to `on`.
    24  
    25  The root `env` section also accepts templates.
    26  
    27  !!! tip
    28      Learn more about the [name template engine](/customization/templates/).