I'm getting some really strange behavior when attempting to build a windows version of my go program.
My directory contains:
foo.go
foo_windows.go
foo_windows_test.go
foo_unix.go
foo_linux.go
foo_linux_test.go
foo_darwin.go
Windows builds are failing because the build ignores foo_windows.go, for some reason. Note, there are no // +build
comments in any files. Here's the output of the build file list:
$ GOOS=linux GOARCH=amd64 go list -f '{{.IgnoredGoFiles}}' github.com/foo/
[foo_darwin.go foo_windows.go foo_windows_test.go]
$ GOOS=darwin GOARCH=amd64 go list -f '{{.IgnoredGoFiles}}' github.com/foo/
[foo_linux.go foo_linux_test.go foo_windows.go foo_windows_test.go]
$ GOOS=windows GOARCH=amd64 go list -f '{{.IgnoredGoFiles}}' github.com/foo/
[foo_darwin.go foo_linux.go foo_linux_test.go foo_unix.go foo_windows.go]
Obviously the last item is very wrong. foo_windows.go should not be ignored. Note that when including the methods in foo_windows.go
in foo.go
directly, the windows build succeeds, so it really is excluding the file, and the file contains everything needed for a good build.
Both cross-compiling on a mac and compiling normally on a windows machine lead to the same problems of file exclusion, which leads me to believe it's something about the file itself that is causing problems, but I'm not sure what it might be.
Does anyone have any idea why this is happening?