go version)?$ go version go version devel +4906a00cdd Fri Mar 22 09:07:09 2019 +0000 darwin/amd64
yes.
go env)?go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/lufia/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/lufia"
GOPROXY=""
GORACE=""
GOROOT="/Users/lufia/go"
GOTMPDIR=""
GOTOOLDIR="/Users/lufia/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/lufia/go/src/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0b/8y9l7z3x1pv4p2c5l9f0y6600000gn/T/go-build395440320=/tmp/go-build -gno-record-gcc-switches -fno-common"
If GO111MODULE=on and there is no Go source file in current directory, go clean fails.
$ git clone https://github.com/lufia/go-mod-clean
$ cd go-mod-clean
$ export GO111MODULE=off
$ go clean && echo ok
ok
$ export GO111MODULE=on
$ go clean && echo ok
can't load package: package github.com/lufia/go-mod-clean: unknown import path "github.com/lufia/go-mod-clean": cannot find module providing package github.com/lufia/go-mod-clean
$ go clean ./... && echo ok
ok
I want that go clean is success.
I have seen an error message above.
@bcmills @jayconrod
What did you expect go clean to do in that case? It normally deletes a bunch of legacy files from the current package, but if you're using modules it is unlikely that you have any of those legacy files around.
(Note that both go clean -modcache and go clean -cache now avoid resolving imports, so this issue should only apply to go clean without additional flags.)
I hope go clean become same status either GO111MODULE is set to on or not.
I have a Makefile that like described below:
.PHONY: clean
clean:
go clean
A user that use GOPATH mode above recipe works fine. But now, above Makefile will fail with "cannot find module providing package..." by switching to module-aware mode.
Most helpful comment
I hope
go cleanbecome same status either GO111MODULE is set to on or not.I have a Makefile that like described below:
A user that use GOPATH mode above recipe works fine. But now, above Makefile will fail with "cannot find module providing package..." by switching to module-aware mode.