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 doesn't handle variadic values very well #5059

Closed
fsouza opened this issue Mar 15, 2013 · 2 comments
Closed

cmd/gofmt: gofmt -r doesn't handle variadic values very well #5059

fsouza opened this issue Mar 15, 2013 · 2 comments

Comments

@fsouza
Copy link
Contributor

fsouza commented Mar 15, 2013

When formatting function calls that provide variadic arguments using `slice...`, gofmt
drops "...":

% cat sample.go
package main

func doSomething(args ...string) {
}

func main() {
    values := []string{"a", "b"}
    doSomething(values...)
}
% gofmt -r 'doSomething(a) -> DoSomething(a)' sample.go
package main

func doSomething(args ...string) {
}

func main() {
    values := []string{"a", "b"}
    DoSomething(values)
}

It rewrote doSomething(values...) to DoSomething(values), meaning that the code does not
compile anymore.
@griesemer
Copy link
Contributor

Comment 1:

Owner changed to @griesemer.

Status changed to Started.

@griesemer
Copy link
Contributor

Comment 2:

This issue was closed by revision 9115e41.

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

3 participants