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

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

cmd/go: do not ignore explicit _foo.go argument #21045

LionNatsu opened this issue Jul 17, 2017 · 1 comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@LionNatsu
Copy link
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 cmd: do nothing with explicitly specified "_*" file cmd/go: do nothing with explicitly specified "_*" file Jul 17, 2017
@bradfitz bradfitz added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label 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
Copy link
Contributor

This is related to #21529.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jul 6, 2018
@rsc rsc changed the title cmd/go: do nothing with explicitly specified "_*" file cmd/go: do not ignore explicit _foo.go argument Oct 25, 2018
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 25, 2018
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 25, 2018
@bcmills bcmills modified the milestones: Go1.12, Go1.13 Jan 18, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@bcmills bcmills modified the milestones: Go1.14, Unplanned Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

8 participants