You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:
Run "go version" and compare against
http://golang.org/doc/devel/release.html If a newer version of Go exists,
install it and retry what you did to reproduce the problem.
Thanks.
What does 'go version' print?
[andrewk@macaque-2]:~/src/g1$ go version
go version go1.3 darwin/amd64
What steps reproduce the problem?
[andrewk@macaque-2]:~/src$ mkdir g1
[andrewk@macaque-2]:~/src$ cd g1
[andrewk@macaque-2]:~/src/g1$ ls
[andrewk@macaque-2]:~/src/g1$ export GOPATH=/Users/andrewk/src/g1
[andrewk@macaque-2]:~/src/g1$ cat >windows.go
package main
import "fmt"
func main() {
fmt.Println("Hello, world")
}
[andrewk@macaque-2]:~/src/g1$ go build
can't load package: package .: no buildable Go source files in /Users/andrewk/src/g1
[andrewk@macaque-2]:~/src/g1$ ls
windows.go
[andrewk@macaque-2]:~/src/g1$ go build -work -x
WORK=/var/folders/9p/bnyfm2md0q5_j4wb3zh9_yq00000gn/T/go-build620868854
can't load package: package .: no buildable Go source files in /Users/andrewk/src/g1
[andrewk@macaque-2]:~/src/g1$ mv windows.go main.go
[andrewk@macaque-2]:~/src/g1$ go build -work -x
WORK=/var/folders/9p/bnyfm2md0q5_j4wb3zh9_yq00000gn/T/go-build049576138
mkdir -p $WORK/_/Users/andrewk/src/g1/_obj/
cd /Users/andrewk/src/g1
/opt/local/go/pkg/tool/darwin_amd64/6g -o $WORK/_/Users/andrewk/src/g1.a -trimpath $WORK
-p _/Users/andrewk/src/g1 -complete -D _/Users/andrewk/src/g1 -I $WORK -pack ./main.go
cd .
/opt/local/go/pkg/tool/darwin_amd64/6l -o g1 -L $WORK -extld=/usr/bin/clang
$WORK/_/Users/andrewk/src/g1.a
[andrewk@macaque-2]:~/src/g1$ ls
g1* main.go
What happened?
If file named "windows.go", go compiler doesn't see and compile it.
What should have happened instead?
File should be compiled regardless of its name
Please provide any additional information below.
The text was updated successfully, but these errors were encountered:
I found, that linux.go has the same problem with compilation.
[andrewk@macaque-2]:~/src/g1$ ls
linux.go
[andrewk@macaque-2]:~/src/g1$ go build
can't load package: package .: no buildable Go source files in /Users/andrewk/src/g1
Files named after operating systems are only compiled on those operating systems. See
the package docs for go/build.
Search for "(example: windows.go)" at http://golang.org/pkg/go/build/
I just learned this too in issue #8344.
Thank you Brad. If it is documented, it is obviously a feature, not a bug :-) the issue
can be closed, although I find this compiler behaviour a little bit disappointing. I
wanted to move my functions, which work with windows (UI windows, not MS Windows) to
another file. Ok, I use another name.
by aklyachkin:
The text was updated successfully, but these errors were encountered: