goimports-reviser alternatives and similar packages
Based on the "Editor Plugins" category.
Alternatively, view goimports-reviser alternatives based on common mentions on social networks and blogs.
-
Go for Visual Studio Code
DISCONTINUED. An extension for VS Code which provides support for the Go language. -
GoSublime
A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features. -
coc-go language server extension for Vim/Neovim
Go language server extension using gopls for coc.nvim. -
Watch
Watches for changes in a directory tree and reruns a command in an acme win or just on the terminal. -
Local Golang playground
GNU/Emacs mode that setup local Go playground for code snippets like play.golang.org or even better :)
InfluxDB high-performance time series database

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of goimports-reviser or a related project?
README
πΊπ¦ #StandWithUkraine πΊπ¦
goimports-reviser 
['logo'](./images/reviser-muscot_200.png)
Tool for Golang to sort goimports by 3-4 groups(with own [linter](linter/README.md)): std, general, company(which is optional) and project dependencies.
Also, formatting for your code will be prepared(so, you don't need to use gofmt
or goimports
separately).
Use additional options -rm-unused
to remove unused imports and -set-alias
to rewrite import aliases for versioned packages or for packages with additional prefix/suffix(example: opentracing "github.com/opentracing/opentracing-go"
).
-company-prefixes
- will create group for company imports(libs inside your organization). Values should be comma-separated.
Configuration:
Cmd
goimports-reviser -rm-unused -set-alias -format ./reviser/reviser.go
You can also apply rules to a dir or recursively apply using ./... as a target:
goimports-reviser -rm-unused -set-alias -format -recursive reviser
goimports-reviser -rm-unused -set-alias -format ./...
Example, to configure it with JetBrains IDEs (via file watcher plugin):
[example](./images/image.png)
Options:
Usage of goimports-reviser:
-apply-to-generated-files
Apply imports sorting and formatting(if the option is set) to generated files. Generated file is a file with first comment which starts with comment '// Code generated'. Optional parameter.
-company-prefixes string
Company package prefixes which will be placed after 3rd-party group by default(if defined). Values should be comma-separated. Optional parameters.
-format
Option will perform additional formatting. Optional parameter.
-imports-order string
Your imports groups can be sorted in your way.
std - std import group;
general - libs for general purpose;
company - inter-org or your company libs(if you set '-company-prefixes'-option, then 4th group will be split separately. In other case, it will be the part of general purpose libs);
project - your local project dependencies.
Optional parameter. (default "std,general,company,project")
-list-diff
Option will list files whose formatting differs from goimports-reviser. Optional parameter.
-output string
Can be "file", "write" or "stdout". Whether to write the formatted content back to the file or to stdout. When "write" together with "-list-diff" will list the file name and write back to the file. Optional parameter. (default "file")
-project-name string
Your project name(ex.: github.com/incu6us/goimports-reviser). Optional parameter.
-recursive
Apply rules recursively if target is a directory. In case of ./... execution will be recursively applied by default. Optional parameter.
-rm-unused
Remove unused imports. Optional parameter.
-set-alias
Set alias for versioned package names, like 'github.com/go-pg/pg/v9'. In this case import will be set as 'pg "github.com/go-pg/pg/v9"'. Optional parameter.
-set-exit-status
set the exit status to 1 if a change is needed/made. Optional parameter.
-use-cache
Use cache to improve performance. Optional parameter.
Install
With Brew
brew tap incu6us/homebrew-tap
brew install incu6us/homebrew-tap/goimports-reviser
With Snap
snap install goimports-reviser
Examples
Before usage:
package testdata
import (
"log"
"github.com/incu6us/goimports-reviser/testdata/innderpkg"
"bytes"
"github.com/pkg/errors"
)
After usage:
package testdata
import (
"bytes"
"log"
"github.com/pkg/errors"
"github.com/incu6us/goimports-reviser/testdata/innderpkg"
)
Comments(not Docs) for imports is acceptable. Example:
package testdata
import (
"fmt" // comments to the package here
)
Example with -company-prefixes
-option
Before usage:
package testdata // goimports-reviser/testdata
import (
"fmt" //fmt package
"github.com/pkg/errors" //custom package
"github.com/incu6us/goimports-reviser/pkg" // this is a company package which is not a part of the project, but is a part of your organization
"goimports-reviser/pkg"
)
After usage:
package testdata // goimports-reviser/testdata
import (
"fmt" // fmt package
"github.com/pkg/errors" // custom package
"github.com/incu6us/goimports-reviser/pkg" // this is a company package which is not a part of the project, but is a part of your organization
"goimports-reviser/pkg"
)
Example with -format
-option
Before usage:
package main
func test(){
}
func additionalTest(){
}
After usage:
package main
func test(){
}
func additionalTest(){
}
Give a Star! β
If you like or are using this project, please give it a star.
Stargazers
*Note that all licence references and agreements mentioned in the goimports-reviser README section above
are relevant to that project's source code only.