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

cmd/go: clean on module uses directory name #26991

Open
DeedleFake opened this Issue Aug 14, 2018 · 3 comments

Comments

Projects
None yet
5 participants
@DeedleFake

DeedleFake commented Aug 14, 2018

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

go version go1.11rc1 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOCACHE="$HOME/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="$HOME/go"
GOPROXY=""
GORACE=""
GOROOT="$HOME/sdk/go1.11rc1"
GOTMPDIR=""
GOTOOLDIR="/Users/moquality/sdk/go1.11rc1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/var/folders/6b/nk1h2bp93yn4_c35zvn2845c0000gq/T/tmp.kodrU4ryxD/node/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/6b/nk1h2bp93yn4_c35zvn2845c0000gq/T/go-build046724770=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

mkdir example
cd example
go mod init modname
echo 'package main; func main() {println("This is an example.")}' > example.go
go build -v # This produces a file called 'modname'.
go clean -x # This attempts to delete a file called 'example'.

What did you expect to see?

go clean should use the module name to delete rather than the directory name.

What did you see instead?

go clean attempted to use the directory name to delete the previously created executable.

@andybons

This comment has been minimized.

Member

andybons commented Aug 15, 2018

@bcmills

This comment has been minimized.

Member

bcmills commented Sep 13, 2018

Likely the same root cause as #27283.

@rsc

This comment has been minimized.

Contributor

rsc commented Oct 25, 2018

Possibly same root cause but possibly not. In any event I agree it should use the final (non-version) element of the module path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment