Go to file
dependabot[bot] fb66c0d601
chore(deps): bump golang.org/x/tools from 0.24.0 to 0.25.0 (#83)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.24.0 to 0.25.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-10 23:09:02 +07:00
.github chore: remove goreleaser 2024-06-10 02:09:02 +07:00
cmd/gofimports feat: improve perf by use astFile for dstFile 2023-01-17 17:52:29 +07:00
internal feat: add stock mode (#37) 2023-07-10 20:41:08 +07:00
.gitignore feat: add profiler 2023-01-17 18:17:28 +07:00
.golangci.yml chore: sync golangci-lint config 2024-05-08 01:13:34 +07:00
CHANGELOG.md chore(changelog): generate v0.0.12 2024-08-22 14:32:30 +07:00
LICENSE chore: add MIT license 2022-11-24 23:16:50 +07:00
README.md chore: add badges 2024-06-08 15:55:53 +07:00
go.mod chore(deps): bump golang.org/x/tools from 0.24.0 to 0.25.0 (#83) 2024-09-10 23:09:02 +07:00
go.sum chore(deps): bump golang.org/x/tools from 0.24.0 to 0.25.0 (#83) 2024-09-10 23:09:02 +07:00
justfile chore: migrate to justfile 2024-08-22 14:31:46 +07:00

README.md

gofimports

Go gitleaks Go Reference Latest Version

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

Thanks