3acaa08687
Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.27.3 to 2.27.4. - [Release notes](https://github.com/urfave/cli/releases) - [Changelog](https://github.com/urfave/cli/blob/main/docs/CHANGELOG.md) - [Commits](https://github.com/urfave/cli/compare/v2.27.3...v2.27.4) --- updated-dependencies: - dependency-name: github.com/urfave/cli/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
||
---|---|---|
.github | ||
cmd/gofimports | ||
internal | ||
.gitignore | ||
.golangci.yml | ||
CHANGELOG.md | ||
LICENSE | ||
Makefile | ||
README.md | ||
go.mod | ||
go.sum |
README.md
gofimports
Group Go imports with my opinionated preferences.
First is standard. Then third party, then company if exist. The last is local.
Also main selling point of this tool is to handle imports only. So please run
gofumpt
or gofmt
to format you files after running this tool.
Install
With Go version >= 1.16
:
go install github.com/haunt98/gofimports/cmd/gofimports@latest
Usage
# Format ./internal with:
# - print impacted file (-l),
# - write to file (-w),
# - print diff (-d)
# - company prefix, split using comma (,)
gofimports -l -w -d --company github.com/make-go-great,github.com/haunt98 ./internal
# Format ./internal with:
# - write
# - stock mode, only split standard and non standard
gofimports -w --stock ./internal
Example result:
import (
"fmt"
"github.com/urfave/cli/v2"
"github.com/pkg/diff"
"github.com/make-go-great/color-go"
"github.com/haunt98/gofimports/internal/imports"
)
Roadmap
- Diff with color
- Add profiling
- Improve performance