安装 golang Shopify/sarama Kafka 库时出错
Error installing golang Shopify/sarama Kafka library
安装 golang
github.com/Shopify/sarama
kafka
库时出现以下错误
go get github.com/Shopify/sarama
# github.com/Shopify/sarama
go/src/github.com/Shopify/sarama/config.go:678:37: undefined: io.Discard
go/src/github.com/Shopify/sarama/decompress.go:43:10: undefined: io.ReadAll
go/src/github.com/Shopify/sarama/decompress.go:55:10: undefined: io.ReadAll
go/src/github.com/Shopify/sarama/sarama.go:89:29: undefined: io.Discard
从 Go 1.16 开始,ioutil.Discard
和 ioutil.ReadAll
分别移动到 io.Discard
和 io.ReadAll
,
你应该使用 Go 1.16 或使用旧版本的 sarama(我认为 v1.20.1 应该适用于 go1.13)
也来自sarama's README:
Sarama provides a "2 releases + 2 months" compatibility guarantee: we
support the two latest stable releases of Kafka and Go, and we provide
a two month grace period for older releases. This means we currently
officially support Go 1.15 through 1.16, and Kafka 2.7 through 2.8,
although older releases are still likely to work.
安装 golang
github.com/Shopify/sarama
kafka
库时出现以下错误
go get github.com/Shopify/sarama
# github.com/Shopify/sarama
go/src/github.com/Shopify/sarama/config.go:678:37: undefined: io.Discard
go/src/github.com/Shopify/sarama/decompress.go:43:10: undefined: io.ReadAll
go/src/github.com/Shopify/sarama/decompress.go:55:10: undefined: io.ReadAll
go/src/github.com/Shopify/sarama/sarama.go:89:29: undefined: io.Discard
ioutil.Discard
和 ioutil.ReadAll
分别移动到 io.Discard
和 io.ReadAll
,
你应该使用 Go 1.16 或使用旧版本的 sarama(我认为 v1.20.1 应该适用于 go1.13)
也来自sarama's README:
Sarama provides a "2 releases + 2 months" compatibility guarantee: we support the two latest stable releases of Kafka and Go, and we provide a two month grace period for older releases. This means we currently officially support Go 1.15 through 1.16, and Kafka 2.7 through 2.8, although older releases are still likely to work.