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: do not ignore explicit _foo.go argument #21045

Open
LionNatsu opened this Issue Jul 17, 2017 · 1 comment

Comments

Projects
None yet
7 participants
@LionNatsu
Contributor

LionNatsu commented Jul 17, 2017

go version go1.8.3 linux/amd64
GOPATH="/home/lion/aosc/ciel"
PWD="/home/lion/aosc/ciel"

What did you do?

go fmt src/ciel/_main.go
go vet src/ciel/_main.go
go generate src/ciel/_main.go
...

What did you expect to see?

Take go fmt as the example.
It should do something like go fmt src/ciel/anotherfile.go.

What did you see instead?

can't load package: package main: no buildable Go source files in /home/lion/aosc/ciel/src/ciel

I understand _file will be ignored by go tools when I specified a package:
https://godoc.org/cmd/go/#hdr-Description_of_package_lists

Directory and file names that begin with "." or "_" are ignored by the go tool, as are directories named "testdata".

But, according to the context, this rule is for package, when I pass a file name to argument explicitly, it should not ignore them.

I think this maybe relevant to go/build.Context.UseAllFiles.

https://godoc.org/pkg/go/build/#Context

type Context struct {
    GOARCH      string // target architecture
    GOOS        string // target operating system
    GOROOT      string // Go root
    GOPATH      string // Go path
    CgoEnabled  bool   // whether cgo can be used
    UseAllFiles bool   // use files regardless of +build lines, file names
    Compiler    string // compiler to assume when computing target paths

@bradfitz bradfitz changed the title from cmd: do nothing with explicitly specified "_*" file to cmd/go: do nothing with explicitly specified "_*" file Jul 17, 2017

@bradfitz bradfitz added this to the Go1.10 milestone Jul 17, 2017

@rsc rsc modified the milestones: Go1.10, Go1.11 Dec 1, 2017

@dmitshur

This comment has been minimized.

Member

dmitshur commented May 11, 2018

This is related to #21529.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jul 6, 2018

@rsc rsc changed the title from cmd/go: do nothing with explicitly specified "_*" file to cmd/go: do not ignore explicit _foo.go argument Oct 25, 2018

@bcmills bcmills added the NeedsFix label Oct 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment