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: gofmt -r can't parse 'var a SomeType -> var a AnotherType' #4430

Closed
jmhodges opened this issue Nov 24, 2012 · 11 comments
Closed

cmd/gofmt: gofmt -r can't parse 'var a SomeType -> var a AnotherType' #4430

jmhodges opened this issue Nov 24, 2012 · 11 comments
Assignees

Comments

@jmhodges
Copy link
Contributor

@jmhodges jmhodges commented Nov 24, 2012

$  gofmt -r 'var a SomeType -> var a AnotherType' run_test.go 
parsing pattern var a msg : .:1:1: expected operand, found 'var'
@jmhodges
Copy link
Contributor Author

@jmhodges jmhodges commented Nov 24, 2012

Comment 1:

Not a huge deal, since I can just sed it, but it would be nice to use the same tool.
@minux
Copy link
Member

@minux minux commented Nov 24, 2012

Comment 2:

a related issue: https://golang.org/issue/4406
gofmt's -r options use go/parser.ParseExpr to parse the input, so only
expression is allowed in a rewrite.
@griesemer
Copy link
Contributor

@griesemer griesemer commented Nov 27, 2012

Comment 3:

Owner changed to @griesemer.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 9, 2012

Comment 4:

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

Status changed to Accepted.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 9, 2012

Comment 5:

Labels changed: added go1.1maybe, removed go1.1.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 10, 2012

Comment 6:

Labels changed: added size-l.

@robpike
Copy link
Contributor

@robpike robpike commented Mar 7, 2013

Comment 7:

Labels changed: removed go1.1maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Nov 27, 2013

Comment 8:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 9:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 10:

Labels changed: added repo-main.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Sep 10, 2014

Comment 11:

The gofmt rewrite mechanism is nice but also a historical artifact. At this point it
makes more sense to have a more general and separate rewrite tool instead.
Making this specific feature work in gofmt will only prompt other rewrite notations that
are also not accepted. Decided to not take any action and leave this to a future, more
sophisticated tool.

Status changed to Unfortunate.

@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
Linked pull requests

Successfully merging a pull request may close this issue.

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