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

x/website: /doc/code#ImportingRemoteDocumentation describes different behaviour when adding remote modules than 1.16 exhibits #44790

Closed
abstrask opened this issue Mar 4, 2021 · 2 comments

Comments

@abstrask
Copy link

abstrask commented Mar 4, 2021

What version of Go are you using (go version)?

$ go version
go version go1.16 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH=amd64
GOHOSTARCH=amd64
GOHOSTOS=windows

What did you do?

Ran go install after adding remote module "github.com/google/go-cmp/cmp" to import block.

What did you expect to see?

go: finding module for package github.com/google/go-cmp/cmp
go: downloading github.com/google/go-cmp v0.4.0
go: found github.com/google/go-cmp/cmp in github.com/google/go-cmp v0.4.0

What did you see instead?

hello.go:7:2: no required module provides package github.com/google/go-cmp/cmp; to add it:
        go get github.com/google/go-cmp/cmp

More info

The Importing packages from remote modules section of the "How to Write Go Code" page states:

When you run commands like go install, go build, or go run, the go command will automatically download the remote module and record its version in your go.mod file.

However, since version 1.16 that no longer seems to be correct. From the "No automatic changes to go.mod and go.sum" section of the New module changes in Go 1.16 blog post:

Previously, when the go command found a problem with go.mod or go.sum like a missing require directive or a missing sum, it would attempt to fix the problem automatically
...
In Go 1.16, module-aware commands report an error after discovering a problem in go.mod or go.sum instead of attempting to fix the problem automatically. In most cases, the error message recommends a command to fix the problem.

@gopherbot gopherbot added this to the Unreleased milestone Mar 4, 2021
@fzipp
Copy link
Contributor

fzipp commented Mar 4, 2021

Duplicate of #44241 (comment)

This is already fixed on tip.golang.org: https://tip.golang.org/doc/code#ImportingRemote

@dmitshur
Copy link
Contributor

dmitshur commented Mar 5, 2021

Thanks. The fix is deployed on golang.org now too.

@dmitshur dmitshur closed this as completed Mar 5, 2021
@golang golang locked and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants