`go test crypto/tls/...` indeed works fine (from $HOME), but I want to run benchmarks as well, which fails: ``` $ pwd /home/leon $ go test -bench crypto/tls/... can't load package: package .: no Go files in /home/leon ```
``` $ go env | grep "GO\(PATH\|ROOT\).*" GOPATH="/home/leon/dev/go" GOROOT="/usr/local/Cellar/go/1.9.1/libexec" # <- Homebrew install ``` Running benchs from inside $GOROOT however works :o ``` $ pwd /usr/local/Cellar/go/1.9.1/libexec # <- Homebrew install $ go test -bench ./... ``` Why do benchs of the Go standard library need to be run from $GOROOT? This is so confusing. On 17.10.2017, at 23:54, Ian Lance Taylor <i...@golang.org> wrote: > > On Tue, Oct 17, 2017 at 2:43 PM, <goo...@leonklingele.de> wrote: >> >> I was wondering how to run tests and benchmarks of the Go standard library >> such as this one: >> https://go-review.googlesource.com/c/go/+/44730/4/src/crypto/tls/handshake_server_test.go#1056 >> >> $ pwd >> $GOPATH/src/github.com/golang/go/src/crypto/tls >> $ git rev-parse HEAD >> 5f740d6875ab6961381f2f4614b21ff6ddf448a4 >> $ go version >> go version go1.9.1 linux/amd64 >> $ go test -v ./... >> common.go:10:2: use of internal package not allowed > > My first guess would be that the version of `go` on your PATH does not > think that $GOPATH/src/github.com/golang/go/src/crypto/tls is in > GOROOT. Which is also suggested by the fact that it is in GOPATH. > Normally GOROOT and GOPATH should be distinct. > > Note that in general you can run `go test crypto/tls/...` from any > directory to test the crypto/tls directory and its subdirectories. > > Ian ----------------------------------------------------------------------- ------------------------------------------------------------------------ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Message signed with OpenPGP using GPGMail