$ tree
.
├── [id].go
├── go.mod
└── lib
└── a
└── a.go
2 directories, 3 files
$ cat go.mod
module work
go 1.15
$ cat [id].go
package main
import "work/lib/a"
func main() {
println(a.V)
}
$ cat lib/a/a.go
package a
var V = "Searching all the dark corners for every foot gun we can get our tentacles on..."
The go command is unhappy about the file name [id].go
$ go build
package work: invalid input file name "[id].go"
What I expected to see
gopls detects the problem and reports it as diagnostic message.
What I saw instead
gopls doesn't report any error.
Things get more confusing if we rename the lib directory to _lib directory.
Now gopls reports a compiler error, but that's not about the file name.
Finally, if I fixed the file name - rename [id].go to id.go (but kept using _lib directory) , the error message disappear and go build also succeeds.
The text was updated successfully, but these errors were encountered:
gopherbot
added
Tools
This label describes issues relating to any tools in the x/tools repository.
gopls
Issues related to the Go language server, gopls.
labels
Jan 20, 2021
go version: go1.16beta1
gopls version: v0.6.4
how to repro
The go command is unhappy about the file name
[id].go
What I expected to see
gopls detects the problem and reports it as diagnostic message.
What I saw instead
gopls doesn't report any error.
Things get more confusing if we rename the

lib
directory to_lib
directory.Now
gopls
reports a compiler error, but that's not about the file name.Finally, if I fixed the file name - rename
[id].go
toid.go
(but kept using_lib
directory) , the error message disappear andgo build
also succeeds.The text was updated successfully, but these errors were encountered: