https://github.com/hedhyw/go-import-lint
Golang source code analyzer that checks imports order. It verifies that standard, current package, and vendor imports are separated by a line.
https://github.com/hedhyw/go-import-lint
go go-linter golang imports linter
Last synced: about 1 month ago
JSON representation
Golang source code analyzer that checks imports order. It verifies that standard, current package, and vendor imports are separated by a line.
- Host: GitHub
- URL: https://github.com/hedhyw/go-import-lint
- Owner: hedhyw
- License: mit
- Created: 2020-09-12T09:08:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-01T06:47:24.000Z (about 1 year ago)
- Last Synced: 2025-03-18T17:05:37.605Z (about 1 month ago)
- Topics: go, go-linter, golang, imports, linter
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-import-lint


[](https://goreportcard.com/report/github.com/hedhyw/go-import-lint)
[](https://coveralls.io/github/hedhyw/go-import-lint?branch=master)Golang source code analyzer that checks imports order. It verifies that:
- standard, current package, and vendor imports are separated by a line;
- there are no blank lines between one import group;
- there are no more than two lines.Example of good imports order:
```go
package main// CGo import.
import "C"import (
// Standart imports.
"fmt"
"error"// Current package imports.
"github.com/hedhyw/go-import-lint/internal/linter"
"github.com/hedhyw/go-import-lint/internal/model"// External imports.
"github.com/hedhyw/jsonscjson"
"github.com/stretchr/testify/assert"// Unused imports.
_ "github.com/lib/pq"
)
```## Installation
### Go
```sh
go install github.com/hedhyw/go-import-lint/cmd/go-import-lint@latest
```## Usage example
Run:
`go-import-lint`
```
Usage of go-import-lint:
-exclude value
paths to exclude (default ./vendor, ./.git)
-path value
paths to lint (default ./...)
-pkg string
module package
```