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
Then this will return a error:'3:1: expected 'package', found 'import' (and 1 more errors)'
What did you expect to see?
An interesting thing is that if I put an empty line between the first line(comment) and second line(package gorequest), the error will disappear and the output is correct:
["bytes" "encoding/json" "errors" "io/ioutil" "net" "net/http" "net/url" "reflect" "strings" "time"]
The text was updated successfully, but these errors were encountered:
Sorry, it is an issue from this function func Ioutil(name string) string, which will remove the first '\n', I copied from other sources, sorry for disturbing.
What version of Go are you using (
go version
)?What did you do?
I was trying to use the go/parser to extract dependency from go files, and I followed this example example-ParseFile, here is my code:
And the test example's code is like
Then this will return a error:'3:1: expected 'package', found 'import' (and 1 more errors)'
What did you expect to see?
An interesting thing is that if I put an empty line between the first line(comment) and second line(package gorequest), the error will disappear and the output is correct:
["bytes" "encoding/json" "errors" "io/ioutil" "net" "net/http" "net/url" "reflect" "strings" "time"]
The text was updated successfully, but these errors were encountered: