You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This particular error wouldn't belong in the import parsing section. Firstly, the error is raised on the line with the import, not on the line with the package declaration. Secondly, it is not necessary that the offending token is a package declaration. The below snippet just as well triggers this error:
package main
import"fmt"funcmain() {}
import"net/http"
Regarding the snippet you have shared, it raises the error "non-declaration statement outside function body" on the line with the duplicate package declaration. That is not handled as a part of the import parsing, and is a completely different error.
I notice that invalid import declaration will introduce an error element in parser.errors. https://github.com/golang/go/blob/master/src/go/parser/parser.go#L2846
I think it would be better if an invalid package name declaration appear.
The text was updated successfully, but these errors were encountered: