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

LionNatsu opened this issue Jul 17, 2017 · 1 comment


None yet
8 participants
Copy link

commented Jul 17, 2017

go version go1.8.3 linux/amd64

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:

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.

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 this to the Go1.10 milestone Jul 17, 2017

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


This comment has been minimized.

Copy link

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 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 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.