The repository was named
[...]/test.go, and the default container directory for
git clone is the repo name, so the containing directory is named
go help build:
If the package is main and file names are provided, the file name derives from the first file name mentioned, such as f1 for 'go build f1.go f2.go'; with no files provided ('go build'), the output file name is the base name of the containing directory.
In this case the output is a file called
test.go. The problem is:
In the directory containing the package, .go, .c, .h, and .s files are considered part of the package
go build if the output from a previous build,
test.go, exists, it will be treated as a source file, triggering the 'unexpected NUL in input' message.
The problem can be resolved by renaming the directory to avoid the build output having a name that will be considered part of the package.