-
Notifications
You must be signed in to change notification settings - Fork 17.3k
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
Apparent inconsistency in gofmt replacement rules application #643
Labels
Comments
Read the documentation for the gofmt rewrite rule carefully. http://golang.org/cmd/gofmt/ The pattern interface{} is a valid Go expression (a composite literal), the pattern Buffer is not. |
The thing is that Buffer is defined elsewhere as: type Buffer []interface which is identical to how Vector is defined in container/vector and the make rule is in essence identical to the make rule used there generate: vector.go vector_test.go < vector.go cat\ | gofmt -r='Vector -> IntVector'\ | gofmt -r='interface{} -> int'\ > intvector.go\ and so the behaviour in the case I presented appears inconsistent with code that exists in the standard pkg collection. |
Apparently there is more going on here than just my stupidity as I have another situation where apparently valid replacement rules aren't being honoured. In this case it's a simple transform for a method name which doesn't result in any change: gofmt -r 'TestRealloc -> TestPointerRealloc' buffer_test.go > pointer_test.go is the command-line in question and I've attached the buffer_test.go file it's being applied to. Attachments:
|
Owner changed to g...@golang.org. Status changed to Accepted. |
This issue was closed by revision b32f22b. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by loughlinmchugh:
The text was updated successfully, but these errors were encountered: