make clean libzstd.a fails with a file system permission error if using Go modules as implemented in Go 1.11. The make clean target tries to remove the libzstd_target file, but Go has set the current directory to Unix permission 0555, which does not allow removing files.
Seems that with the move to modules, the Go project is taking an aggressive stance on this. Their deciding reason is that this, in particular, prevents unit tests, which are run from their containing directory, from modifying the contents of their directory.
Either make clean libzstd.a succeeds or there is some workaround.
Steps to reproduce
Bash script:
export GOPATH=/tmp/go
mkdir $GOPATH
cd $GOPATH
mkdir main
cd main
cat > main.go <<EOF
package main
import "github.com/valyala/gozstd"
func main() {
dst := make([]byte, 1024)
src := make([]byte, 1024)
gozstd.Compress(dst, src)
}
EOF
cat > go.mod <<EOF
module main
require github.com/valyala/gozstd v1.2.1
EOF
go get
cd $GOPATH/pkg/mod/github.com/valyala/gozstd@v1.2.1
make clean libzstd.a
Issue
make clean libzstd.a
fails with a file system permission error if using Go modules as implemented in Go 1.11. Themake clean
target tries to remove the libzstd_target file, but Go has set the current directory to Unix permission 0555, which does not allow removing files.Specifically:
Seems that with the move to modules, the Go project is taking an aggressive stance on this. Their deciding reason is that this, in particular, prevents unit tests, which are run from their containing directory, from modifying the contents of their directory.
See https://github.com/golang/go/issues/27161.
Expected
Either
make clean libzstd.a
succeeds or there is some workaround.Steps to reproduce
Bash script: