kisielk/vendorize

Vendorize output is not gofmted

cespare opened this issue · 5 comments

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.

I thought it would leave it as-is? I don't have a problem gofmt'ing it if not.

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.

PR would be welcome. go/format wasn't a thing when I wrote this package :)

will do

Nice, seems to be a one-line change. See #12.