OS: linux/amd64
GO: 1.5.1
When running (go run *.go
) the below code I get the following error and I don't understand what I'm doing wrong. I've read the official doc about build constrains. Shouldn't foo_windows.go
be ignored?
# command-line-arguments
./foo_windows.go:3: hello redeclared in this block
previous declaration at ./foo_linux.go:3
main.go
package main
import "fmt"
func main() {
fmt.Println(hello())
}
foo_linux.go
package main
func hello() string {
return "hello form linux"
}
foo_windows.go
package main
func hello() string {
return "hello form windows"
}