Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix go.mod replace for api by using older semantics #8113

Merged
merged 1 commit into from
Jun 4, 2020

Conversation

tgross
Copy link
Member

@tgross tgross commented Jun 4, 2020

No description provided.

@tgross tgross requested review from notnoop and shoenig June 4, 2020 13:50
@tgross tgross force-pushed the go_mod_fix_replace branch from ddfe157 to e64bb55 Compare June 4, 2020 13:50
@shoenig
Copy link
Contributor

shoenig commented Jun 4, 2020

For reference, the new behavior is described in https://golang.org/doc/go1.14#go-command

When the main module contains a top-level vendor directory and its go.mod file specifies go 1.14 or higher, the go command now defaults to -mod=vendor for operations that accept that flag. A new value for that flag, -mod=mod, causes the go command to instead load modules from the module cache (as when no vendor directory is present).
When -mod=vendor is set (explicitly or by default), the go command now verifies that the main module's vendor/modules.txt file is consistent with its go.mod file.

This is inconvenient for local development, where working on the api package requires explicitly setting -mod=mod, and totally breaks integration with IDEs like GoLand (e.g. https://youtrack.jetbrains.com/issue/GO-9428)

For now, setting go1.13 in the go.mod file alleviates the problem, as newer versions of the Go compiler respect the older build semantics.

It would be nice if the compiler would be more intelligent about submodules, especially in this case (e.g. golang/go#33789)

@tgross tgross merged commit e3db589 into master Jun 4, 2020
@tgross tgross deleted the go_mod_fix_replace branch June 4, 2020 14:33
tgross added a commit that referenced this pull request Jun 4, 2020
tgross added a commit that referenced this pull request Jun 4, 2020
@github-actions
Copy link

github-actions bot commented Jan 3, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants