Here is a simple golang script T1.go:
package main
import "fmt"
func main() {
fmt.Println("Hello world")
}
run it with go run T1.go
, I get:
T1.go:1:15: expected ';', found 'import'
If I added ;
to line end, the program is okay to run:
package main;
import "fmt";
func main() {
fmt.Println("Hello world")
}
But isn't the semicolon redundant of line ending in golang?
PS: I am on 64bit window 7, the golang version is devel +f4d1cb8d9a91
or 1.2rc1. The error code runs perfect on http://play.golang.org/
Updates I've used dos2unix
to convert the source code to unix line ending, but it doesn't change anything
Notes My go is installed in C:\go
directory and the C:\go\bin
is added into the %PATH%
environment variable; The source code T1.go
is put inside the C:\t\go
directory, which is different from the go installation directory. Not sure if this configuration contribute to the issue.