Skip to content

goimportx is a tool to help you manage your go imports.

License

Notifications You must be signed in to change notification settings

kesonan/goimportx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goimportx

Go License: MIT Go Reference

中文|English

goimportx is a tool to help you manage your go imports.

Features

  • Automatically sort and group your go imports.
  • Support custom group rules.
  • Support write result to file.
  • Only support go module.
  • Use golang official sort algorithm.
  • Automatically remove parentheses when there is only one import.
  • Automatically remove duplicate empty new-line.
Features goimports goimportx
Automatically sort and group your go imports
Support custom group rules
Support write result to file
Automatically remove parentheses when there is only one import
Automatically remove duplicate empty new-line
Support mutilple files, mutilple dirtories

Installation

$ go install github.com/anqiansong/goimportx@latest

Usage

$ goimportx --dir /path/to/dir --file /path/to/file.go

Help

goimportx --help
sort and group go imports

Usage:
  goimportx [flags]

Examples:
goimportx --dir path/to/your/dir --file /path/to/file.go --group "system,local,third"

Flags:
  -d, --dir strings    file directory
  -f, --file string    file path
  -g, --group string   group rule, split by comma, only supports [system,local,third,others] (default "system,local,third")
  -h, --help           help for goimportx
  -v, --version        version for goimportx
  -w, --write          write result to (source) file instead of stdout

About

goimportx is a tool to help you manage your go imports.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages