Make unit-test error: non-constant format string in call to Printf

Recently I was setting up my development environment on a new computer to work on the Incus project, following these steps . However as soon as I try to call make unit-test on the most recent commit I get this specific error all over the code base:

cmd/incus/info.go:139:14: non-constant format string in call to fmt.Printf

where it’s caused by statements such as:

fmt.Printf(prefix + i18n.G("DRM:") + "\n")

However it satisfies all the tests on the test runner and in my previous development setup, I never ran into this issue (some of the files throwing errors were last changed almost a full month ago). So would anyone have any tips on resolving this problem I am having?

For context, this is my Go version right now:

go version go1.24.2 linux/amd64

Welcome!

The printf package in golang defines an Analyzer, and the unit tests are using that analyzer to throw warnings/errors like the one you are mentioning.

I do not know when this Analyzer was added to printf. The apparent workaround would be to change

fmt.Printf(prefix + i18n.G("DRM:") + "\n")

to

fmt.Printf("%s", prefix + i18n.G("DRM:") + "\n")

Does it throw an error or is it just a warning?

It throws an error because the files affected are failing the build process.

If there’s a way I can work around this issue without having to change the actual code would be ideal. Would you happen to know the setup for the test runner on Github?

As it can be seen here, cmd/vet: report printf calls with non-const format and no args · Issue #60529 · golang/go · GitHub, this is a new and recent change to the Go language. The proper way to solve this, is to fix the occurrences in the code as I mention above.

If you want a workaround for now, you can use a slightly older Go package that does not have the change.