-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
$ go version go version go1.16 darwin/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 GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/jayconrod/Library/Caches/go-build" GOENV="/Users/jayconrod/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/jayconrod/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/jayconrod/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/opt/go/installed" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/opt/go/installed/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.16" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rq/x0692kqj6ml8cvrhcqh5bswc008xj1/T/go-build2665939977=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
In a directory, without a go.mod file, create a .go file that imports a package outside the standard library. Use go build, go run, or similar commands on that file:
cat >hello.go <<EOF
package main
import (
"fmt"
"rsc.io/quote"
)
func main() {
fmt.Println(quote.Hello())
}
EOF
go run hello.go
What did you expect to see?
An error message that explains what went wrong and how to fix it.
These commands work without errors in GOPATH mode, but since Go 1.16, module-aware mode is enabled by default (GO111MODULE defaults to on instead of auto). See #41330.
It's possible to restore the old behavior in 1.16 by running go env -w GO111MODULE=auto, but this likely will not work in Go 1.17: we plan to drop support for GOPATH mode and GO111MODULE.
What did you see instead?
hello.go:6:2: no required module provides package rsc.io/quote: working directory is not part of a module
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.