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/gofmt: remove empty var, const, and type blocks #7631

Closed
josharian opened this issue Mar 25, 2014 · 5 comments
Closed

cmd/gofmt: remove empty var, const, and type blocks #7631

josharian opened this issue Mar 25, 2014 · 5 comments
Milestone

Comments

@josharian
Copy link
Contributor

1. http://play.golang.org/p/bC6o-ibOnw
2. Hit Format.

It'd be nice for gofmt to remove the empty var, const, and type blocks, yielding just:

package main

func main() {}

Why not just not write them in the first place? It can be easier to do pretty code
generation if you don't have to worry about whether there'll be anything in the block,
trusting gofmt to clean up after you. See e.g. https://golang.org/cl/78870047/.
@bradfitz
Copy link
Contributor

Comment 1:

To Robert to decide for Go 1.4.

Labels changed: added release-go1.4, repo-main.

Owner changed to @griesemer.

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 2:

In general we don't have (default) gofmt add or remove things except for whitespace
(i.e., except for changing the formatting).
That said, this could be done with gofmt -s which simplifies code. Leaving open for 1.4.

@simon-whitehead
Copy link
Contributor

Comment 3:

Hello.
I have just submitted this for review. This is my first submission - so I hope it's
okay. It happens in the simplify method as described above.
Link here: https://golang.org/cl/101410046/

@gopherbot
Copy link

Comment 4:

CL https://golang.org/cl/101410046 mentions this issue.

@griesemer
Copy link
Contributor

Comment 5:

This issue was closed by revision 138099a.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#7631.

LGTM=gri
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/101410046
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Fixes golang#7631.

LGTM=gri
R=golang-codereviews, bradfitz, gri
CC=golang-codereviews
https://golang.org/cl/101410046
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

6 participants