cloudflare / hellogopher

Hellogopher: "just clone and make" your conventional Go project
MIT License
1.15k stars 59 forks source link

make test (and x-compile) fails if stdlib folder is not writeable #7

Open mgilbir opened 7 years ago

mgilbir commented 7 years ago

Hi,

I've given hellogopher a try for an internal project at work to replace our own homegrown Makefile but I'm stumped on this error:

$ make test
go install errors: open /usr/local/go/pkg/darwin_amd64_race/errors.a: permission denied
go install internal/race: open /usr/local/go/pkg/darwin_amd64_race/internal/race.a: permission denied
go install encoding: open /usr/local/go/pkg/darwin_amd64_race/encoding.a: permission denied
go install unicode/utf16: open /usr/local/go/pkg/darwin_amd64_race/unicode/utf16.a: permission denied
go install unicode/utf8: open /usr/local/go/pkg/darwin_amd64_race/unicode/utf8.a: permission denied
go install crypto/subtle: open /usr/local/go/pkg/darwin_amd64_race/crypto/subtle.a: permission denied
go install crypto/internal/cipherhw: open /usr/local/go/pkg/darwin_amd64_race/crypto/internal/cipherhw.a: permission denied
go install internal/nettrace: open /usr/local/go/pkg/darwin_amd64_race/internal/nettrace.a: permission denied
go install container/list: open /usr/local/go/pkg/darwin_amd64_race/container/list.a: permission denied
go install vendor/golang_org/x/crypto/curve25519: open /usr/local/go/pkg/darwin_amd64_race/vendor/golang_org/x/crypto/curve25519.a: permission denied
go install unicode: open /usr/local/go/pkg/darwin_amd64_race/unicode.a: permission denied
go install math: open /usr/local/go/pkg/darwin_amd64_race/math.a: permission denied
make: *** [test] Error 1

I'm running:

$ go version
go version go1.8rc2 darwin/amd64

Any tips on where to look to try to get this working?

FiloSottile commented 7 years ago

Ah, yes, this is when your user can't modify the standard library installation.

Hellogopher runs tests with "-i -race", so that the race libraries are saved for later. If your distribution didn't ship a race-enabled standard library, it will try to save the artifacts.

But since you don't have permission, it fails.

This is annoying, because I don't want to disable "-i" as building race libraries is slow and many users benefit from the incremental builds.

I'll work on it. In the meantime, you can just remove the "go test -i" line.

FiloSottile commented 7 years ago

Note for myself: this will happen also cross-compiling, which is not as easy to catch.

mgilbir commented 7 years ago

Just got bitten by the cross-compiling you mentioned:

$ GOOS=linux make app
go install runtime/internal/sys: mkdir /usr/local/go/pkg/linux_amd64: permission denied
make: *** [cylon] Error 1