Skip to content

Commit d5e80b3

Browse files
committed
bump min go version to go1.15
The DialTLSConfig option bumped the min version to go1.15 from the previous go1.13. The recent introduction of net.ErrClosed bumped the min version to go1.16. We can still support go1.15 by having a separate build file. We will drop 1.13: it's very old, go1.17 is out now (so go1.15 is technically unsupported), and some of the deps use go1.15 (notably, compress). Closes twmb#69
1 parent 03598c8 commit d5e80b3

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/twmb/franz-go
22

3-
go 1.13
3+
go 1.15
44

55
require (
66
github.com/golang/snappy v0.0.4 // indirect

pkg/kgo/errors.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010
)
1111

1212
func isRetriableBrokerErr(err error) bool {
13+
if err == nil { // sanity
14+
return true
15+
}
1316
// https://github.com/golang/go/issues/45729
1417
//
1518
// Temporary is relatively useless. We will still check for the
@@ -38,7 +41,7 @@ func isRetriableBrokerErr(err error) bool {
3841
}
3942
// EOF can be returned if a broker kills a connection unexpectedly, and
4043
// we can retry that. Same for ErrClosed.
41-
if errors.Is(err, net.ErrClosed) || errors.Is(err, io.EOF) {
44+
if isNetClosedErr(err) || errors.Is(err, io.EOF) {
4245
return true
4346
}
4447
// We could have chosen a broker, and then a concurrent metadata update

pkg/kgo/go115.go

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//go:build go1.15
2+
// +build go1.15
3+
4+
package kgo
5+
6+
import "strings"
7+
8+
func isNetClosedErr(err error) bool {
9+
return strings.Contains(err.Error(), "use of closed network connection")
10+
}

pkg/kgo/go116.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//go:build go1.16 && !go1.15
2+
// +build go1.16,!go1.15
3+
4+
package kgo
5+
6+
import (
7+
"errors"
8+
"net"
9+
)
10+
11+
func isNetClosedErr(err error) bool {
12+
return errors.Is(err, net.ErrClosed)
13+
}

0 commit comments

Comments
 (0)