golang grouping import tool
gogimport will grouping imports by stdlib, thirdparty, local packages like the example below, unlike what goimports did, we prefer to do it this way:
- do not remove unuse import, is useful when our codes is in development.
- force grouping into three groups, this reduce the changed lines so tha make code review simple.
$ gogimport -local github.com/wusendong/example main.go
package main
import (
"fmt"
"log"
"gopkg.in/redis.v5"
"github.com/gorilla/context"
"github.com/wusendong/example"
)
go get -u github.com/wusendong/gogimport
Usage of gogimport:
gogimport [options] [file ...]
Options:
-local string
local package name
Example command:
gogimport -local ${packaname} some.go other.go