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

go/printer: output not handling commas + comments correctly #1542

Closed
gopherbot opened this issue Feb 22, 2011 · 6 comments
Closed

go/printer: output not handling commas + comments correctly #1542

gopherbot opened this issue Feb 22, 2011 · 6 comments

Comments

@gopherbot
Copy link

by zhengbaiqiang:

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. use gofmt format the following code
var a = []int{1,2, /*jasldf*/
}


What is the expected output?
valid code that compiles

What do you see instead?
var a = []int{1, 2 /*jasldf*/
}

this will generate compile errors

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Ubuntu 64bit

Which revision are you using?  (hg identify)
b2be017f9134 release/release.2011-02-15

Please provide any additional information below.
@peterGo
Copy link
Contributor

peterGo commented Feb 22, 2011

Comment 1:

There appears to be a failure for all types of comments. The following compiles before
gofmt; it does not compile after gofmt.
syntax error: unexpected semicolon or newline, expecting }
non-declaration statement outside function body
syntax error: unexpected }
package comments
func general() {
    var a = []int{1, 2, /*jasldf*/
    }
    _ = a
}
func generalspan() {
    var a = []int{1, 2, /*jasldf
                        */
    }
    _ = a
}
func line() {
    var a = []int{1, 2, // jasldf 
    }
    _ = a
}

@rsc
Copy link
Contributor

rsc commented Feb 22, 2011

Comment 2:

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

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Dec 9, 2011

Comment 3:

Labels changed: added priority-later, removed priority-medium.

@rsc
Copy link
Contributor

rsc commented Jan 29, 2012

Comment 4:

Related to issue #1505, although in this case the position information is presumably
correct.

@griesemer
Copy link
Contributor

Comment 5:

This was fixed with issue #1505, but to have a concrete test, see:
http://golang.org/cl/5645080

@griesemer
Copy link
Contributor

Comment 6:

This issue was closed by revision a0acdd2.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
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

4 participants