I'm trying to run the hello world from golang in this link But when I run go install, I'm getting this error:
hello.go:1:1: illegal character U+0023
This is my hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world")
}
I'm using Mac OS El Captain What is wrong?
you have '#' in first line of your code which is invalid,
see this test sample code:
# just remove this line
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
this will give this error:
hello.go:1:1: illegal character U+0023 '#'
but if you remove lines containing #
it works fine:
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
it seems your IDE is not for Go. See:
https://github.com/visualfc/liteide
https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins
http://www.distilnetworks.com/setup-go-golang-ide-for-mac-os-x/
I had the same problem but had no '#' in the source whatsoever. My LOCALE was set correctly. My problem was that I created the source via cut and paste from:
The problem was solved by deleting and retyping the double quotes in the source. Just for grins I tried a cut and paste from:
https://golang.org/doc/code.html
and had no problems. Go figure.