Vendorize output is not gofmted
cespare opened this issue · 5 comments
cespare commented
Raw go/printer output is not gofmted. I think other similar tools do a gofmt pass afterwards. That would be nice so the user doesn't have to do it.
kisielk commented
I thought it would leave it as-is? I don't have a problem gofmt'ing it if not.
cespare commented
There are some weird whitespace changes. Here's an example:
github.com/cespare/foobar/foobar.go:
package foobar
var (
A = 123
Bcdef = 123
)
github.com/cespare/baz/baz.go
package main
import "github.com/cespare/foobar"
var x = foobar.A
Then I run
$ vendorize github.com/cespare/baz github.com/cespare/baz/internal && find baz/internal 2015/04/11 18:31:14 copying contents of "/home/caleb/p/go/src/github.com/cespare/foobar" to "/home/caleb/p/go/src/github.com/cespare/baz/internal/github.com/cespare/foobar"
baz/internal
baz/internal/github.com
baz/internal/github.com/cespare
baz/internal/github.com/cespare/foobar
baz/internal/github.com/cespare/foobar/foobar.go
$ diff foobar/foobar.go baz/internal/github.com/cespare/foobar/foobar.go
4,5c4,5
< A = 123
< Bcdef = 123
---
> A = 123
> Bcdef = 123
I know that other tools (e.g. gorename) use go/format
to print. Should be easy enough to do here. I'll send over a PR unless you get to it first.
kisielk commented
PR would be welcome. go/format wasn't a thing when I wrote this package :)
cespare commented
will do