Skip to content

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

@abstrask

Description

@abstrask

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions