Skip to content

Commit

Permalink
fix: support vendored modules
Browse files Browse the repository at this point in the history
Correctly support vendoring go modules when the 'vendor' build option is
true.

Signed-off-by: Link Dupont <[email protected]>
  • Loading branch information
subpop committed Feb 14, 2023
1 parent a488835 commit 4e5a0d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions build-aux/vendor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

pushd "${MESON_DIST_ROOT}" || exit 1
go mod vendor
popd || exit 1
8 changes: 4 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ project('yggdrasil',

go = find_program('go')

if get_option('vendor')
meson.add_dist_script(join_paths('build-aux', 'vendor.sh'))
endif

goldflags = ''
goldflags += ' -X "github.com/redhatinsights/yggdrasil/internal/constants.Version=' + meson.project_version() + '"'
goldflags += ' -X "github.com/redhatinsights/yggdrasil/internal/constants.DefaultPathPrefix=' + meson.project_name() + '"'
Expand All @@ -27,10 +31,6 @@ subdir('cmd/yggctl')
subdir('cmd/yggd')
subdir('data')
subdir('doc')
if get_option('vendor')
run_command(go, 'mod', 'vendor')
subdir('vendor')
endif

summary(
{
Expand Down

0 comments on commit 4e5a0d8

Please sign in to comment.