Skip to content
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 -x removes *.so but doesn't list such files in output #33573

Open
zephyrtronium opened this issue Aug 9, 2019 · 1 comment

Comments

@zephyrtronium
Copy link

commented Aug 9, 2019

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

$ go version
go version go1.12.7 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
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/zephyrtronium/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/zephyrtronium/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build755048247=/tmp/go-build -gno-record-gcc-switches"

What did you do?

~/mygo/plugintest$ printf 'package main\n\nvar String = "Hello, world!"\n' >plugin.go
~/mygo/plugintest$ go build -buildmode=plugin
~/mygo/plugintest$ go clean -x

What did you expect to see?

rm -f including plugintest.so, or plugintest.so still present in the directory.

What did you see instead?

cd /home/zephyrtronium/go/src/github.com/zephyrtronium/plugintest
rm -f plugintest plugintest.exe plugintest.test plugintest.test.exe plugin plugin.exe

plugintest.so was removed by go clean, but not listed in its output. It seems that any files removed via https://github.com/golang/go/blob/master/src/cmd/go/internal/clean/clean.go#L323 aren't printed, which includes *.so (which the documentation says come from SWIG).

@bcmills bcmills added this to the Unplanned milestone Aug 12, 2019

@bcmills bcmills added the help wanted label Aug 12, 2019

@zephyrtronium

This comment has been minimized.

Copy link
Author

commented Aug 14, 2019

Reading through clean.go, it looks like there are three reasonable options:

  1. Add files matching cleanFile and cleanExt to allRemove, which currently only contains possible executable file outputs. This is an easy fix, and I'm currently trying it locally.
  2. Remove .so from cleanExt and instead remove those files in the way that *.exe is removed. This seems appropriate because a shared object in the package directory is probably from any of the various shared build modes rather than from SWIG in the modern era. I'm still uncomfortable with any files being removed without being printed in -n and -x.
  3. Follow up on // TODO: Remove once Makefiles are forgotten. It's been over seven years since the go command was released, and almost five years since go generate. It's impossible to be certain that no one is using Makefiles, but at the very least, the go command isn't included in (the text of) the Go 1 compatibility promise.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.