krew icon indicating copy to clipboard operation
krew copied to clipboard

go test error when building with go 1.24

Open buckaroogeek opened this issue 7 months ago • 2 comments

I am working on a Fedora rpm for krew. The rpm spec file for golang projects has a %check section where go test is executed for unit test files in the package.

The rpm build process succeeds with Fedora 41 which is using golang 1.23 at this time.

The rpm build process fails with Fedora 41 and rawhide (future F44) which are using golang 1.24 at this time. The go test error is:

Testing    in: /builddir/build/BUILD/krew-0.4.5-build/krew-0.4.5/_build/src
         PATH: /builddir/build/BUILD/krew-0.4.5-build/krew-0.4.5/_build/bin:/usr/bin:/bin:/usr/sbin:/sbin
       GOPATH: /builddir/build/BUILD/krew-0.4.5-build/krew-0.4.5/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags " -X sigs.k8s.io/krew/version=0.4.5 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '"
      testing: sigs.k8s.io/krew
sigs.k8s.io/krew/cmd/krew/cmd
# sigs.k8s.io/krew/cmd/krew/cmd
# [sigs.k8s.io/krew/cmd/krew/cmd]
./root.go:117:36: non-constant format string in call to sigs.k8s.io/krew/cmd/krew/cmd/internal.PrintWarning
FAIL    sigs.k8s.io/krew/cmd/krew/cmd [build failed]

This, it seems, is due to a more strict printf analyzer in go vet (https://tip.golang.org/doc/go1.24#vet).

Are there plans to accomdate golang 1.24?

thanks

buckaroogeek avatar May 12 '25 20:05 buckaroogeek

If you're building at a version that the project not yet supports, you can probably also disable vet?

ahmetb avatar May 12 '25 20:05 ahmetb

Thanks. Current spec file syntax does not support disabling vet but I can skip go test for select files and directories which does work.

buckaroogeek avatar May 12 '25 21:05 buckaroogeek