module
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Jun 28, 2025
License: MIT
Opens a new window with license information.
README
¶
gomodclean
Linter to check dependencies are well structured inside your go.mod file.
Details
#1: Check require lines are grouped into blocks
| Bad | Good |
require github.com/bar/bar v2.0.0
require github.com/foo/foo v1.2.3
|
require (
github.com/bar/bar v2.0.0
github.com/foo/foo v1.2.3
)
|
Note:
If there is just one direct or indirect require directive, there is no need to encapsulate it into a require block, so the following example is valid:
require github.com/foo/foo v1.2.3
require (
github.com/bar/bar v2.0.0 // indirect
github.com/cosa/cosita v5.3.3 // indirect
)
#2: Check go.mod file only contains 2 require blocks
| Bad | Good |
require (
github.com/foo/foo v1.2.3
)
require (
github.com/bar/bar v2.0.0
)
require (
github.com/cosa/cosita v5.3.3 // indirect
)
|
require (
github.com/bar/bar v2.0.0
github.com/foo/foo v1.2.3
)
require (
github.com/cosa/cosita v5.3.3 // indirect
)
|
#3: Check the first require block only contains direct dependencies while the second one only contains indirect ones
| Bad | Good |
require (
github.com/dmrioja/shodo v1.0.0 // indirect
github.com/foo/foo v1.2.3
)
require (
github.com/bar/bar v2.0.0
github.com/cosa/cosita v5.3.3 // indirect
)
|
require (
github.com/bar/bar v2.0.0
github.com/foo/foo v1.2.3
)
require (
github.com/cosa/cosita v5.3.3 // indirect
github.com/dmrioja/shodo v1.0.0 // indirect
)
|
Usage
🚧 Work in Progress...
Directories
¶
|
|
|
internal
|
|
|
|
|
|
|
|
pkg
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.