Skip to content

cmd/go: go fmt fails in symlinked directory #32725

@sguillia

Description

@sguillia

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

$ go version
go version go1.12 linux/amd64

Does this issue reproduce with the latest release?

If latest release is go 1.12 then yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/rof/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rof/"
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-build784063998=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I have one directory which is a clone of my git repo. Let's call it project.
I have a symbolic link to that directory. Let's call it link.

This works fine

$ cd src/github.com/.../project
$ go fmt

This does not work fine

$ cd link
$ go fmt
stat ../src/github.com/.../main.go: no such file or directory
exit status 2

What did you expect to see?

I expected go fmt to work with no error.

What did you see instead?

I saw a no such file or directory error, but the file exists.

Additional information

$ strace go fmt |& grep \\.\\./src
waitid(P_PID, 10294, stat ../src/github.com/.../main.go: no such file or directory

$ strace go fmt |& grep \\.\\./src
futex(0xe474e8, FUTEX_WAIT_PRIVATE, 0, NULLstat ../src/github.com/.../main.go: no such file or directory

go fmt in the link directory fails 100% of the time.
50% of time, futex fails.
50% of time, waitid fails.

This runs in the docker environment of my cloud CI, Codeship. I am reporting the bug here since everything else works fine.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoCommandcmd/goNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions