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: fails with for range over array/slice literal containing composite literal(s) of named type #748

Closed
stevenblenkinsop opened this issue Apr 27, 2010 · 3 comments

Comments

@stevenblenkinsop
Copy link

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. gofmt this program:

package main

type T []int

func main() {
    for _ = range []T{T{42}} {
    }
}

What is the expected output? What do you see instead?
.../TestGo.go:6:21: expected '}', found '{'
.../TestGo.go:7:2: expected declaration, found '}'
.../TestGo.go:8:1: expected declaration, found '}'

What is your $GOOS?  $GOARCH?
linux 386

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

Please provide any additional information below.
gofmt does work when the slice literal is in round brackets 
("([]T{T{42}})"). It strips the outer brackets, meaning the next time it 
won't work.

Attachments:

  1. TestGo.go (76 bytes)
@adg
Copy link
Contributor

adg commented Apr 27, 2010

Comment 1:

Verified bug.

Owner changed to [email protected].

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 2:

Status changed to Started.

@griesemer
Copy link
Contributor

Comment 3:

This issue was closed by revision 2bfc2d7.

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