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

invalid mutation for `var _ = ...` #32

Closed
mmcloughlin opened this issue Jul 29, 2019 · 2 comments

Comments

@mmcloughlin
Copy link

commented Jul 29, 2019

Just a quick note about an awkward edge case. gofumpt replaces var _ = ... with _ := ..., which errors with no new variables on left side of :=.

@mmcloughlin

This comment has been minimized.

Copy link
Author

commented Jul 29, 2019

$ cat main.go
package main

func main() {
	var _ = "Hello, World!"
}
$ gofumpt main.go
package main

func main() {
	_ := "Hello, World!"
}
$ gofumports main.go
package main

func main() {
	_ := "Hello, World!"
}
$ go build main.go
$ gofumpt -w main.go
$ go build main.go
# command-line-arguments
./main.go:4:4: no new variables on left side of :=
@mvdan

This comment has been minimized.

Copy link
Owner

commented Jul 29, 2019

Thanks - indeed forgot about an edge case.

@mvdan mvdan closed this in 96300e3 Jul 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.