go - Golang import grouping by package -


i see go has goimports import grouping, i'm wondering if has created package group imports in groupings pattern?

go imports little enforcing @ least 2 groupings stdlib , else; however, company has policy of grouping imports in 4 groups

import (     stdlib      current_project      company      others  ) 

is there tool can automatically this?

the latest version of goimports support -local flag. quoting this commit message:

for example, running goimports -local example.com/ might produce

import (     "database/sql"     "io"     "strconv"      "golang.org/x/net/context"      "example.com/foo/bar"     "example.com/foo/baz" ) 

Comments