Page MenuHomeFreeBSD

Mk/Uses/go.mk: introduce no_vendor_dir
AbandonedPublic

Authored by mikael on Apr 9 2022, 7:55 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 10, 4:42 AM
Unknown Object (File)
Sat, May 4, 10:22 PM
Unknown Object (File)
Mon, Apr 29, 8:48 PM
Unknown Object (File)
Apr 21 2024, 9:31 PM
Unknown Object (File)
Apr 6 2024, 2:09 AM
Unknown Object (File)
Jan 14 2024, 12:32 PM
Unknown Object (File)
Jan 13 2024, 1:05 PM
Unknown Object (File)
Dec 26 2023, 7:14 AM

Details

Reviewers
ygy
dmgk
Summary

The purpose of this flag is to not populate the vendor directory as it causes some problem with go 1.18 and some ports (sysutils/zrepl and net/syncthing for example)
Ideally we should move the go modules (for example /usr/ports/distfiles/go/sysutils_zrepl) somewhere in WRKDIR so that we can patch them if needed (à la cargo-crates)

Test Plan

exp-run

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mikael requested review of this revision.Apr 9 2022, 7:55 AM
mikael created this revision.

This looks good to me for now. Please go ahead, thanks @mikael!

This revision is now accepted and ready to land.Apr 21 2022, 4:04 AM
dmgk requested changes to this revision.May 4 2022, 11:49 AM

Vendoring dependencies is needed so we're able to patch them locally. Patching directly in $GOCACHE (e.g. /usr/ports/distfiles/go/sysutils_zrepl) won't work because go verifies integrity of cached dependencies and will refuse to build if it detects any changes (that's why we don't checksum deps ourselves and delegate their integrity checking to go).

Starting with go1.16, go additionally checks (in modules mode) that vendored dependencies are actually correspond to the dependencies listed in go.mod. We had a few problems with ports shipping outdated "vendor" before, but it is not an issue anymore because upstreams are now forced to vendor correct versions.

If there are any issues with dependencies vendored by the upstream (old versions, incompatibilities etc), the best course of action would be to just remove packaged "vendor" and patch/re-vendor at our side.

This revision now requires changes to proceed.May 4 2022, 11:49 AM