cenkalti/backoff

Version 3.0.0 seems to be incompatible with Go modules

0x5a17ed opened this issue · 3 comments

Specifying in the go.mod file

require github.com/cenkalti/backoff v3.0.0

and running go mod tidy will correct the previous line to

require github.com/cenkalti/backoff v0.0.0-20190511092443-4b4cebaf850e

and leads to the error message by go mod tidy

go: finding github.com/cenkalti/backoff v3.0.0
go: github.com/cenkalti/backoff@v0.0.0-20190511092443-4b4cebaf850e: go.mod has post-v0 module path "github.com/cenkalti/backoff/v3" at revision 4b4cebaf850e
go: error loading module requirements

Tested in an empty directory with a main.go file

package main

import (
	"fmt"

	"github.com/cenkalti/backoff"
)

func main() {
	ticker := backoff.NewTicker(backoff.NewExponentialBackOff())

	for t := range ticker.C {
		fmt.Println(t)
	}

	return
}

and the go.mod file

module backoffexample

go 1.12

require github.com/cenkalti/backoff v0.0.0-20190511092443-4b4cebaf850e

The correct import path is github.com/cenkalti/backoff/v3.

You must put

require github.com/cenkalti/backoff/v3 v3.0.0

into your go.mod file.

Yep, just upgraded my repos to v3 and it worked fine for me.