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

cmd/go2go: format in playground creates invalid code #41195

Closed
rogpeppe opened this issue Sep 2, 2020 · 4 comments
Closed

cmd/go2go: format in playground creates invalid code #41195

rogpeppe opened this issue Sep 2, 2020 · 4 comments
Assignees
Labels
Milestone

Comments

@rogpeppe
Copy link
Contributor

@rogpeppe rogpeppe commented Sep 2, 2020

The Format button in https://go2goplay.golang.org/ adds a type prefix to all the type parameters, which it then rejects as a syntax error.
To reproduce, just go to https://go2goplay.golang.org/ and click Format, then Run.

@dmitshur dmitshur added this to the Unreleased milestone Sep 2, 2020
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Sep 2, 2020

@griesemer griesemer self-assigned this Sep 2, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 2, 2020

Change https://golang.org/cl/252879 mentions this issue: [dev.go2go] cmd/gofmt, go/format: set []-mode for type parameters in a few more places

@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 2, 2020

I assumed this was fixed with https://go-review.googlesource.com/c/go/+/251278 but I guess not. Trying once more.

The real fix is to remove all the various parsing and printing modes again, now that we have presumably settled on the type parameter list syntax.

gopherbot pushed a commit that referenced this issue Sep 2, 2020
…a few more places

Now that we have mostly settled on the type parameter list syntax we should
probably remove the various modes of parsing and printing. For now just set
the UseBrackets flag explicitly when printing.

Updates #41195.

Change-Id: I56b06b4f930908579a38a140e8221618c8e2fa17
Reviewed-on: https://go-review.googlesource.com/c/go/+/252879
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 23, 2020

This is now also fixed in the playground after a recent update.

@griesemer griesemer closed this Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.