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: leading underscore in folder name causes issues #34670

Closed
carnott-snap opened this issue Oct 2, 2019 · 5 comments
Closed

cmd/go: leading underscore in folder name causes issues #34670

carnott-snap opened this issue Oct 2, 2019 · 5 comments

Comments

@carnott-snap
Copy link

@carnott-snap carnott-snap commented Oct 2, 2019

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

$ go version
go version go1.13.1 linux/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/user/.local/share/umake/go/go-lang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/user/.local/share/umake/go/go-lang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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-build175172522=/tmp/go-build -gno-record-gcc-switches"

What did you do?

[user@localhost ~]$ mkdir -p /tmp/_test
[user@localhost ~]$ cd /tmp/_test
[user@localhost ~]$ go mod init test # replacing this with a valid routable path has no impact
[user@localhost ~]$ echo 'package test; import _ "gopkg.in/yaml.v2"' > test.go
[user@localhost ~]$ cat go.mod 
module test

go 1.13
[user@localhost ~]$ go build
[user@localhost ~]$ cat go.mod 
module test

go 1.13

require gopkg.in/yaml.v2 v2.2.4
[user@localhost ~]$ go mod tidy
[user@localhost ~]$ cat go.mod

What did you expect to see?

// go.mod
module test

go 1.13

require gopkg.in/yaml.v2 v2.2.4

What did you see instead?

It appears that go mod tidy either fails, thus removes all existing dependencies:

module test

go 1.13
@robpike

This comment has been minimized.

Copy link
Contributor

@robpike robpike commented Oct 3, 2019

The go command's documentation says, "// Files whose names begin with "_" (including "_test.go") or "." are ignored."
I suspect that's the root of it.

@carnott-snap

This comment has been minimized.

Copy link
Author

@carnott-snap carnott-snap commented Oct 3, 2019

To confirm, if I have a go module contained within /home/user/_workspace is that expected to cause the cause the toolchain concern? My expectation is that in GOPATH mode it should, since /home/user/go/src/.../_mypackage is part of the import path, but in module mode the toolchain should only look down the file tree, right?

I can reproduce the same behaviour with /tmp/.test as well.

@andybons

This comment has been minimized.

Copy link
Member

@andybons andybons commented Oct 3, 2019

@andybons andybons added this to the Unplanned milestone Oct 3, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Oct 3, 2019

@carnott-snap, this should be fixed with a go binary built from head. (Please let us know if you find that is not the case.)

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Oct 3, 2019

Duplicate of #28481

@bcmills bcmills marked this as a duplicate of #28481 Oct 3, 2019
@bcmills bcmills closed this Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.