Skip to content
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

gofmt: bad semicolon+comment interaction in imports (hurts cgo) #414

Closed
gopherbot opened this issue Dec 12, 2009 · 3 comments
Closed

gofmt: bad semicolon+comment interaction in imports (hurts cgo) #414

gopherbot opened this issue Dec 12, 2009 · 3 comments

Comments

@gopherbot
Copy link
Contributor

by peter.hans.froehlich:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Try to run an import list with semicolons and commas through cgo.

What is the expected output? What do you see instead?
Expected: Compiles. Actual: Syntax error.

What is your $GOOS?  $GOARCH?
GOARCH=amd64
GOOS=linux

Which revision are you using?  (hg identify)
e7f3b2a4d933 tip

Please provide any additional information below.
I have a module with
this import list:

import (
       "db";   // generic database API
       "fmt";
       "http";
       "os";
       "reflect";
       "strconv";
       "unsafe";
)

After my update cgo now produces this import list in the cgo1.go file:

import (
       "db";
       "fmt" // generic database API
       ;
       "http";
       "os";
       "reflect";
       "strconv";
       "unsafe";
)

Then the lone semicolon causes a syntax error. I can fix this by
removing the comment, but it's probably a cgo bug where the new syntax
rules for semicolons didn't get hacked in yet. :-D
@rsc
Copy link
Contributor

rsc commented Dec 12, 2009

Comment 1:

This is a gofmt bug; assigning to gri.  Simple test case:
; cat x.go
package main
import (
    "fmt";  //hello
    "math";
)
; gofmt x.go
package main
import (
    "fmt";
    "math" //hello
    ;
)

Owner changed to g...@golang.org.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Dec 13, 2009

Comment 2:

Issue #418 has been merged into this issue.

@griesemer
Copy link
Contributor

Comment 3:

This issue was closed by revision 31de4d4.

Status changed to Fixed.

Merged into issue #-.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants