-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
1.8.1
What operating system and processor architecture are you using (go env
)?
darwin x86_64
What did you do?
underscore-test ❯ pwd
/Users/ai/src/go/src/scratch/underscore-test
underscore-test ❯ tree -a
.
├── .dot
│ └── dot.go
├── _underscore
│ └── underscore.go
└── main.go
2 directories, 3 files
underscore-test ❯ cat main.go _underscore/underscore.go .dot/dot.go
package main
import (
"fmt"
"scratch/underscore-test/_underscore"
"scratch/underscore-test/.dot"
)
func main() {
fmt.Println(underscore.Underscore)
fmt.Println(dot.Dot)
}
package underscore
// Underscore is the best yo
const Underscore = "_"
package dot
// Dot is a dot
const Dot = "."
What did you expect to see?
I expected a compilation error, given that documentation states that "." and "_" prefixed files will be ignored, however this rule does not seem to apply to directories. I ran into this yesterday with @davecheney, who suggested that I modify golang/dep to skip scanning directories which start with _
or .
. Currently we're in a weird situation where files are ignored but directories are not, and I can't find any documentation stating what the source of truth should be. Does golang/dep
have the correct behavior, or broken behavior? Will the golang toolchain eventually stop compiling directories that start with .
or _
?
What did you see instead?
It worked:
underscore-test ❯ go build
underscore-test ❯ echo $?
0
underscore-test ❯ ./underscore-test
_
.