Although goimports is a great tool (I use it all the time) it doesn't implement the same import grouping rules that we use, or change any existing groups. I'm tempted to submit a change to it that does that, but I don't know how well it would be received.
On 15 July 2014 13:20, Wayne Witzel <[email protected]> wrote: > Along the same lines, I've been using goimports > (https://github.com/bradfitz/goimports). > > Micheal pointed to it. It wraps go fmt and supports the same flags, but also > adds a layer that removes and adds imports that are unused or needed > respectively. I've had good luck with it running on save with my editor. > > > On Fri, Jul 11, 2014 at 9:07 AM, roger peppe <[email protected]> > wrote: >> >> That's funny - I also have a little Go program that does the same thing. >> I call it "sortimports", and it actually does the sorting rather >> than just reporting that they're not sorted correctly. >> >> http://paste.ubuntu.com/7778940/ >> >> I haven't published it because it doesn't *always* work >> in the presence of comments in the import block (it >> doesn't go wrong, just refuses to touch the block in >> that case). Luckily that only applies to about three >> files in juju-core. >> >> cheers, >> rog. >> >> On 11 July 2014 06:19, Jesse Meek <[email protected]> wrote: >> > I polished off a script this afternoon to check that imports are group >> > correctly. It deals with comments, if the groups are in the wrong order, >> > if >> > there are too many groups and several other edge cases. I *think* I >> > don't >> > have any false positives. >> > >> > Here is the output: http://pastebin.ubuntu.com/7778556/ (Found 31 errors >> > in >> > 26 files) >> > >> > And the PR fixing them: https://github.com/juju/juju/pull/292 >> > >> > Cheers! >> > >> > -- >> > Juju-dev mailing list >> > [email protected] >> > Modify settings or unsubscribe at: >> > https://lists.ubuntu.com/mailman/listinfo/juju-dev >> > >> >> -- >> Juju-dev mailing list >> [email protected] >> Modify settings or unsubscribe at: >> https://lists.ubuntu.com/mailman/listinfo/juju-dev > > > > > -- > Wayne Witzel III > [email protected] -- Juju-dev mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
