kubecost / kubectl-cost

CLI for determining the cost of Kubernetes workloads
Apache License 2.0
872 stars 55 forks source link

Building kubecost fails due to go1.16 being used in go.mod #174

Closed johanneskastl closed 1 month ago

johanneskastl commented 1 month ago

I am trying to package kubectl-cost for openSUSE, but the build fails (with go1.22):

[    5s] + go build -mod=vendor -buildmode=pie -o bin/kubectl-cost ./cmd/kubectl-cost
[    6s] # golang.org/x/exp/constraints
[    6s] vendor/golang.org/x/exp/constraints/constraints.go:13:2: embedding interface element ~int | ~int8 | ~int16 | ~int32 | ~int64 requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    6s] vendor/golang.org/x/exp/constraints/constraints.go:20:2: embedding interface element ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    6s] vendor/golang.org/x/exp/constraints/constraints.go:27:2: embedding interface element Signed | Unsigned requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    6s] vendor/golang.org/x/exp/constraints/constraints.go:34:2: embedding interface element ~float32 | ~float64 requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    6s] vendor/golang.org/x/exp/constraints/constraints.go:41:2: embedding interface element ~complex64 | ~complex128 requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    6s] vendor/golang.org/x/exp/constraints/constraints.go:49:2: embedding interface element Integer | Float | ~string requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] # github.com/opencost/opencost/pkg/collections
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:13:20: type parameter requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:13:22: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:39:25: type parameter requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:39:27: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:46:23: type parameter requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:46:25: predeclared any requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:46:32: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:57:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:66:10: type instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:139:19: type parameter requires go1.18 or later (-lang was set to go1.16; check go.mod)
[    9s] vendor/github.com/opencost/opencost/pkg/collections/blockingqueue.go:66:10: too many errors
[   12s] # golang.org/x/sys/unix
[   12s] vendor/golang.org/x/sys/unix/mremap.go:42:10: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[   12s] vendor/golang.org/x/sys/unix/syscall.go:83:16: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[   12s] vendor/golang.org/x/sys/unix/syscall_linux.go:1009:20: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[   12s] vendor/golang.org/x/sys/unix/syscall_linux.go:2289:9: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[   12s] vendor/golang.org/x/sys/unix/syscall_unix.go:118:7: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[   12s] vendor/golang.org/x/sys/unix/sysvshm_unix.go:33:7: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[   86s] error: Bad exit status from /var/tmp/rpm-tmp.Jt70Nr (%build)

Could you increase the go version in go.mod to 1.18, please? That should be fairly common and should fix those errors...

Thanks in advance Johannes

AjayTripathy commented 1 month ago

Hey @johanneskastl yes! thank you so much for this PR! Let me know if there's anything else we can do for you.

johanneskastl commented 1 month ago

Thanks @AjayTripathy for merging this quickly. Could you cut a new release including those changes?

AjayTripathy commented 1 month ago

Sorry for the late response; we'll get one out soon.