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: go test ./non-existent-directory/... (or empty directory) hangs #31550

Closed
apghero opened this issue Apr 18, 2019 · 2 comments
Closed

Comments

@apghero
Copy link

apghero commented Apr 18, 2019

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

$ go version
go version go1.12.1 darwin/amd64

Does this issue reproduce with the latest release?

$ go version
go version go1.12.4 darwin/amd64

Yes.

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/agwozdziewycz/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/agwozdziewycz/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/agwozdziewycz/Devel/rocksalt/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/jr/fk19fknn1yg5cp_02cymxv0c0000gq/T/go-build265513457=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ ls non-existent-directory
ls: integration-tests: No such file or directory
$ time go test -v ./non-existent-directory/...
^C

real    1m36.344s
user    0m0.027s
sys     0m0.031s
$ ls empty-directory
$
$ time go test -v ./empty-directory/...
^C

real    0m41.663s
user    0m0.025s
sys     0m0.030s

What did you expect to see?

I expected the command to complete immediately, either successfully, or with error.

What did you see instead?

The go command hangs and must be interrupted.

Why was I trying to do this?

A valid question! Obviously it's silly to run tests on a non-existent, or empty directory. However, I expect that the directory will exist in the very next commit, and I had updated the Makefile before making the directory.

@apghero
Copy link
Author

apghero commented Apr 18, 2019

(My colleagues haven't been able to reproduce this. I'm assuming it's something wonky with my setup. Will update again soon)

@apghero
Copy link
Author

apghero commented Apr 18, 2019

A colleague recommended I run with go test -x which led to:

$ go test -x ./thing/...                                                                                                   
mkdir -p /Users/agwozdziewycz/go/pkg/mod/cache/vcs # git2 https://github.com/tidwall/gjson                                                                      
# lock /Users/agwozdziewycz/go/pkg/mod/cache/vcs/50a10c455d1d2a64b8cccf6f307a19ac8419f3acaea3cc3f6b1f4ca6a2f1dd06.lockmkdir -p /Users/agwozdziewycz/go/pkg/mod/$ache/vcs # git2 https://github.com/tidwall/tinyqueue
# lock /Users/agwozdziewycz/go/pkg/mod/cache/vcs/3cfc7f5c2c8f166fda2d80cd8775675942ec54d502378c970d6d5243d8f1abf7.lock^C     

Which led me to finding another hung go get process (not sure what that's all about) that was holding the lock. Killing that process results in the expected behavior:

$ go test -v ./non-existent-dir/...
go: warning: "./non-existent-dir/..." matched no packages
no packages to test

Closing the issue.

@apghero apghero closed this as completed Apr 18, 2019
@golang golang locked and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants