Reputation: 24610
I created a file with square brackets called [id].go
but I am unable to build it.
When I run go build "[id].go"
, I see the the following:
can't load package: package main: invalid input file name "[id].go"
Are there restrictions on Go file names? Specifically, what is not allowed? Please provide documentation if any.
Upvotes: 4
Views: 2572
Reputation: 38233
At the time of writing, Go files must begin with one of the following:
0
through 9
a
through z
A
through Z
.
(period)_
(underscore)/
(forward slash)>= utf8.RuneSelf
(char 0x80 or higher)To be conservative, we reject almost any arg beginning with non-alphanumeric ASCII.
As an example if you try a[id].go
as the file name you should be good to go.
Upvotes: 4