norwoodj/helm-docs

[Bug]: building for openSUSE fails with "unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)"

johanneskastl opened this issue ยท 4 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am packaging this very helpful utility for openSUSE. Currently it fails due to the following error:

[    4s] + go build -mod=vendor -buildmode=pie -o bin/helm-docs ./cmd/helm-docs
[    5s] # golang.org/x/sys/unix
[    5s] 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)
[    5s] vendor/golang.org/x/sys/unix/syscall_linux.go:1018:20: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[    5s] vendor/golang.org/x/sys/unix/syscall_linux.go:2297:9: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
[    5s] 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)
[    5s] 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)
[    5s] error: Bad exit status from /var/tmp/rpm-tmp.KYRhIP (%build)

The go.mod file still states go1.14 as required, I guess this should be increased to go1.17?

(Just changing that one line in the file during build solves this error, but then leads to error due to the vendoring necessary for building without internet connnectivity)

Expected Behavior

Successful build.

Reference Chart

None, no runtime problem.

Reference Template

No response

Environment

Building on openSUSE 64bit

Link to helm-docs Logs

No response

Further Information

No response

Nepo26 commented

Hi @johanneskastl,

I was able to reproduce the bug, and it seems like it was a bug in viper on older go versions, like shown in this issue.

So I will look further into it and see if 'go' really needs to be updated to 1.17.

Furthermore, thank you for the interest in the project! ๐Ÿ˜„

Nepo26 commented

Testing it out, seems like only works with go 1.17 onward.
So I will make this change, but it will not be released right now. I'll triage some changes before the next release.


If anyone is interested in testing out, what I did was the following:

docker run -it golang:1.17 bash

git clone https://github.com/norwoodj/helm-docs

cd helm-docs

sed -i 's/go 1.14/go 1.17/g' go.mod

go mod tidy

go mod vendor

go build -mod=vendor -buildmode=pie -o bin/helm-docs ./cmd/helm-docs

Any news on this?

Fixed with 1.13.0 and go1.22