What version of Go are you using (go version)?
$ go version
go version go1.16 linux/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="/home/cpradm/.cache/go-build"
GOENV="/home/cpradm/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/cpradm/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/cpradm/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/cpradm/git/ptc-cpr-go/hello/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3616770460=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Step 5.2 doesn't work in go version 1.16. The workaround is to add the require directive.
working module hello output:
module hello
go 1.16
require example.com/greetings v0.0.0
replace example.com/greetings => ../greetings
What did you expect to see?
$ go build
go: found example.com/greetings in example.com/greetings v0.0.0-00010101000000-0
What did you see instead?
$ go build
hello.go:5:5: module example.com/greetings provides package example.com/greetings and is replaced but not required; to add it:
go get example.com/greetings
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
Step 5.2 doesn't work in go version 1.16. The workaround is to add the require directive.
working module hellooutput:What did you expect to see?
$ go build
go: found example.com/greetings in example.com/greetings v0.0.0-00010101000000-0
What did you see instead?
$ go build
hello.go:5:5: module example.com/greetings provides package example.com/greetings and is replaced but not required; to add it:
go get example.com/greetings