richardlehane / siegfried

signature-based file format identification
http://www.itforarchivists.com/siegfried
Apache License 2.0
214 stars 30 forks source link

FreeBSD 1.9.5 port: modules: go.mod build failure #204

Closed nunotexbsd closed 1 year ago

nunotexbsd commented 1 year ago

Hello,

I'm updating FreeBSD port from 1.9.4 to 1.9.5.

This port is currently using GO_MODULE variable to the value specified by the module directive in go.mod: GO_MODULE= github.com/richardlehane/siegfried to fetch modules automatically from there and build fails at:

(...)
net/url
vendor/golang.org/x/crypto/chacha20poly1305
# golang.org/x/sys/unix
vendor/golang.org/x/sys/unix/syscall.go:83:7: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
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)
vendor/golang.org/x/crypto/curve25519
(...)
github.com/richardlehane/siegfried/pkg/sets
github.com/richardlehane/siegfried/pkg/wikidata/internal/converter
*** Error code 2

To fix the problem I switched back to "traditional" method gomod-vendor to get modules:

USE_GITHUB=     yes
GH_ACCOUNT=     richardlehane
#GO_MODULE=     github.com/richardlehane/siegfried # fails at github.com/richardlehane/siegfried/pkg/wikidata/internal/converter
GH_TUPLE=       golang:image:e7cb96979f69:golang_image/vendor/golang.org/x/image \
                golang:sys:aba9fc2a8ff2:golang_sys/vendor/golang.org/x/sys \
                golang:text:v0.3.7:golang_text/vendor/golang.org/x/text \
                richardlehane:characterize:v1.0.0:richardlehane_characterize/vendor/github.com/richardlehane/characterize \
                richardlehane:match:v1.0.2:richardlehane_match/vendor/github.com/richardlehane/match \
                richardlehane:mscfb:v1.0.4:richardlehane_mscfb/vendor/github.com/richardlehane/mscfb \
                richardlehane:msoleps:v1.0.3:richardlehane_msoleps/vendor/github.com/richardlehane/msoleps \
                richardlehane:webarchive:v1.0.0:richardlehane_webarchive/vendor/github.com/richardlehane/webarchive \
                richardlehane:xmldetect:v1.0.2:richardlehane_xmldetect/vendor/github.com/richardlehane/xmldetect \
                ross-spencer:spargo:v0.4.1:ross_spencer_spargo/vendor/github.com/ross-spencer/spargo \
                ross-spencer:wikiprov:v0.2.0:ross_spencer_wikiprov/vendor/github.com/ross-spencer/wikiprov

Any clues about this being related to go.mod recent changes?

Thanks, Nuno Teixeira

dmgk commented 1 year ago

The go go.mod directive probably just needs a version bump to (at least) 1.17.

richardlehane commented 1 year ago

thanks for updating the FreeBSD port Nuno! I'm sorry this was my fault: I often do a go get -u to keep the dependencies up-to-date and it looks like recent updates to the golang.org/x/sys/unix package have included some post-1.16 features like unsafe.Slice. I'll fix for the next release.

The reason I try to pin it to 1.16 is because I deploy siegfried as an app to a google appengine which only supports 1.16 max. To fix this issue for google appengine, I added a replace directive to the mod file with this command: go mod edit -replace golang.org/x/sys@v0.0.0-20220909162455-aba9fc2a8ff2=golang.org/x/sys@v0.0.0-20220722155257-8c9f86f7a55f

nunotexbsd commented 1 year ago

Thanks for help and explanation,

Cheers

nunotexbsd commented 1 year ago

Same issue on 1.9.6:

# golang.org/x/sys/unix
vendor/golang.org/x/sys/unix/syscall.go:83:7: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
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)
richardlehane commented 1 year ago

apologies - I overlooked this one when putting out the latest release (the only change in 1.9.6 is a PRONOM update). I'll re-open this so I don't miss it for the next release.

richardlehane commented 1 year ago

go mod is up-to-date with v1.10.0