W
W
Wired Required2016-04-13 22:07:13
go
Wired Required, 2016-04-13 22:07:13

How to fix main.go:1:16: expected ';', found 'import' error?

[email protected] ~/golang/src/golang-book/chapter2                                                                     [21:55:15] 
> $ go run main.go                                                                                                           
main.go:1:16: expected ';', found 'import'                                                                                                                        
[email protected] ~/golang/src/golang-book/chapter2                                                                     [21:55:22] 
> $ go version                                                                                                               
go version go1.2.1 linux/amd64                                                                                                                          
[email protected] ~/golang/src/golang-book/chapter2                                                                     [21:55:25] 
> $ which go                                                                                                                 
/usr/bin/go                                                                                                                         
[email protected] ~/golang/src/golang-book/chapter2                                                                     [21:55:30] 
> $ ls -la /usr/bin/go                                                                                                       
lrwxrwxrwx 1 root root 20 апр.  13 21:47 /usr/bin/go -> /etc/alternatives/go

main.go
package main
import "fmt"
func main() {
  fmt.Println("ok")
}

Tried googling - didn't work.
what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
evnuh, 2016-04-13
@wiredRequired

main.go:1:16: expected ';', found 'import'

You are deceiving us with the above code listing, because the compiler sees `import` on the first line at position 16 of the `main.go` file

A
AmikoYuki, 2016-04-14
@AmikoYuki

This is called Pinocchio himself, what the hell do you have "CR line feed" ???

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question