Go to file
dependabot[bot] a1dbabd57d chore(deps): bump github.com/urfave/cli/v2 from 2.25.1 to 2.25.2
Bumps [github.com/urfave/cli/v2](https://github.com/urfave/cli) from 2.25.1 to 2.25.2.
- [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.25.1...v2.25.2)

---
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>
2023-05-01 22:59:07 +07:00
.github chore(deps): bump actions/setup-go from 3 to 4 2023-03-22 16:25:45 +07:00
cmd/gofimports feat: improve perf by use astFile for dstFile 2023-01-17 17:52:29 +07:00
internal chore: fix lint 2023-02-25 23:57:24 +07:00
.gitignore feat: add profiler 2023-01-17 18:17:28 +07:00
.golangci.yml chore: fix lint 2023-02-25 23:57:24 +07:00
.goreleaser.yml chore: add github action, Makefile 2022-11-24 23:16:32 +07:00
CHANGELOG.md chore(changelog): generate v0.0.8 2023-02-25 23:57:46 +07:00
LICENSE chore: add MIT license 2022-11-24 23:16:50 +07:00
Makefile chore: golds add dark theme 2023-03-13 16:18:31 +07:00
README.md chore: clarify company prefix guide 2023-01-22 11:45:49 +07:00
go.mod chore(deps): bump github.com/urfave/cli/v2 from 2.25.1 to 2.25.2 2023-05-01 22:59:07 +07:00
go.sum chore(deps): bump github.com/urfave/cli/v2 from 2.25.1 to 2.25.2 2023-05-01 22:59:07 +07:00

README.md

gofimports

Go Go Reference

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

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

Thanks