Compilation Error Happens too Often


(Acid Pen) #1

package main
import {
“fmt”
}

func main(){
fmt.Println(“Hello Test”)
}
E:\GO-Learning\Exercises-Src\src>build test.go

E:\GO-Learning\Exercises-Src\src>go build test.go
can’t load package: package main:
test.go:2:8: expected ‘STRING’, found ‘{’
test.go:3:2: expected ‘;’, found “fmt”


(Norbert Melzer) #2

import requires either parenthesis ((, )) with a list of imports or a single import.

It never requires you to write curly braces ({, }).