-
Notifications
You must be signed in to change notification settings - Fork 18k
go/printer: hmac gofix mishandles comments #2750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
Is token location information somehow not invalidated or ignored? This is interesting output too by the way: $ cat x.go package main import "crypto/hmac" func main() { go hmac.NewMD5(nil) // foo } $ gofix x.go x.go:9:22: expected ')', found newline x.go:10:2: expected ';', found ',' Note the "go". I'm completely in the dark on this one... I wrote that gofix, but I have only very basic understanding of AST and it's parser/printer. |
The way to debug this would be to add the test case to the gofix tests and then put some prints in src/cmd/gofix/main_test.go's parseFixPrint to see what the intermediate printing output is. It will have put the // in the wrong place. I believe Robert is working on getting //'s into only right places, so this issue will probably resolve when that gets fixed. |
go/printer incorrectly reformats the gofix-ed program (the comment has incorrect position information) and the rewritten program looks like: package main import ( "crypto/hmac" "crypto/md5" ) func main() { hmac.New(md5.New // foo , nil) } which is clearly incorrect: x.go:9:2: expected 1 expression x.go:10:7: expected statement, found ')' This is a duplicate of issue #1505. |
Owner changed to @griesemer. Status changed to Duplicate. Merged into issue #1505. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: