circuitbreaker
circuitbreaker copied to clipboard
`v2` can't be imported because version path is missing
Problem
Whenever the major version of a Go module is greater than 1, the import path must include /v<major version>. For instance, if a Go module has a major version of 2, the GitHub repository must contain a /v2 directory. For more details, refer to the Go documentation: https://go.dev/wiki/Modules#releasing-modules-v2-or-higher.
Reproducible example
module foo.bar/baz
go 1.22.1
require (
github.com/rubyist/circuitbreaker v2.2.2
)
go mod tidy
...
verifying go.mod: github.com/rubyist/[email protected]+incompatible/go.mod: reading https://sum.golang.org/lookup/github.com/rubyist/[email protected]+incompatible: 404 Not Found
server response: not found: github.com/rubyist/[email protected]+incompatible: invalid version: module contains a go.mod file, so module path must match major version ("github.com/rubyist/circuitbreaker/v2")
Workaround (not recommended)
Import circuitbreaker like this in the go.mod file: github.com/rubyist/circuitbreaker v0.0.0-20240515185911-3933490a9996