Linter to check dependencies are well structured inside your go.mod file.
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
) |
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
)
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
) |
🚧 Work in Progress...