Skip to content

fix(pacmak): go 1.16 requires running "go mod download" explicitly#2616

Merged
eladb merged 1 commit intomainfrom
benisrae/go-mod-download
Feb 28, 2021
Merged

fix(pacmak): go 1.16 requires running "go mod download" explicitly#2616
eladb merged 1 commit intomainfrom
benisrae/go-mod-download

Conversation

@eladb
Copy link
Copy Markdown
Contributor

@eladb eladb commented Feb 28, 2021

Starting go 1.16, go build does not download modules and updates go.sum automatically. To that end, we now execute this before we execute go build during pacmak.

Additionally, set GOSUMDB to off in order to reduce the chance for eventual consistency issues when new modules are published.

Fixes #2615


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Starting go 1.16, `go build` does not download modules and updates go.sum automatically. To that end, we now execute this before we execute `go build` during pacmak.

Additionally, set `GOSUMDB` to `off` in order to reduce the chance for eventual consistency issues when new modules are published.

Fixes #2615
@eladb eladb requested a review from RomainMuller February 28, 2021 08:48
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Feb 28, 2021
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-6Jw05QLuWWwe
  • Commit ID: 34d133d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@eladb eladb merged commit 1f8f022 into main Feb 28, 2021
@eladb eladb deleted the benisrae/go-mod-download branch February 28, 2021 12:31
This was referenced Mar 16, 2021
mergify bot pushed a commit that referenced this pull request Feb 25, 2026
The `GOSUMDB=off` environment variable was added in #2616 back in February 2021 as a workaround to reduce eventual consistency issues when newly published Go modules were not yet available in the Go checksum database. At the time, this was a pragmatic fix to avoid transient failures during `go mod download`.

However, disabling the checksum database prevents the Go toolchain from using `sum.golang.org` which is required for newer features like automatic toolchain management via the `go` directive in `go.mod`. Specifically, `GOSUMDB=off` breaks the ability of `go work use` and related commands to download and verify the correct Go runtime version automatically. This is an increasingly important feature as the Go ecosystem moves towards self-managing toolchains.

Beyond the functional issue, the Go module ecosystem has matured significantly since 2021. The checksum database is stable and eventual consistency is no longer a practical concern for published modules. Keeping `GOSUMDB=off` is both an unnecessary security trade-off (skipping module integrity verification) and now actively prevents useful toolchain features from working.

This change removes the `GOSUMDB=off` setting from the `go()` helper function in jsii-pacmak, restoring default Go behavior.

---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution/core This is a PR that came from AWS.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go 1.16 breaks go pacmak

3 participants