为什么我会得到 undefined: atomic.Bool 的错误?

huangapple go评论176阅读模式
英文:

Why do I get undefined: atomic.Bool

问题

我在构建代码时遇到了以下错误:

+ go build -a -ldflags '-X main.vendorVersion=vpcBlockDriver- -extldflags "-static"' -o /go/bin/ibm-vpc-block-csi-driver ./cmd/
# k8s.io/component-base/metrics
vendor/k8s.io/component-base/metrics/registry.go:35:29: undefined: atomic.Bool
note: module requires Go 1.19

我所做的只是将依赖项更新到1.26.1

这是代码库 - https://github.com/ambiknai/ibm-vpc-block-csi-driver/tree/1.26
我的go版本 - go version go1.20 linux/amd64

英文:

I see below error while building the code.

+ go build -a -ldflags '-X main.vendorVersion=vpcBlockDriver- -extldflags "-static"' -o /go/bin/ibm-vpc-block-csi-driver ./cmd/
# k8s.io/component-base/metrics
vendor/k8s.io/component-base/metrics/registry.go:35:29: undefined: atomic.Bool
note: module requires Go 1.19

All I did was to update dependencies to 1.26.1

This is the code base - https://github.com/ambiknai/ibm-vpc-block-csi-driver/tree/1.26
My go version - go version go1.20 linux/amd64

答案1

得分: 4

你需要升级你的代码库的Go版本,因为它仍然是1.18

在这个文件中进行更改并重新编译应该可以解决问题,因为你的开发环境已经有了1.20

为什么我会得到 undefined: atomic.Bool 的错误?

英文:

You need to upgrade your repo's Go version as it's still 1.18.

Changing it in this file and re-compiling would work as it looks like your dev environment already has 1.20

为什么我会得到 undefined: atomic.Bool 的错误?

huangapple
  • 本文由 发表于 2023年2月21日 16:16:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75517817.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定