From 722fc94744afba96d286e048a3a9641e8bf7dc71 Mon Sep 17 00:00:00 2001 From: Mark Phelps <209477+markphelps@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:23:17 -0500 Subject: [PATCH 1/2] chore: try embed trick to include non-go files on vendor Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> --- flipt-client-go/ext/ext.go | 9 +++++++++ package/ffi/sdks/go.go | 1 + 2 files changed, 10 insertions(+) create mode 100644 flipt-client-go/ext/ext.go diff --git a/flipt-client-go/ext/ext.go b/flipt-client-go/ext/ext.go new file mode 100644 index 00000000..22a04681 --- /dev/null +++ b/flipt-client-go/ext/ext.go @@ -0,0 +1,9 @@ +package ext + +import "embed" + +//go:embed *.h +var _ embed.FS + +// https://github.com/flipt-io/flipt-client-sdks/issues/558 +// to support vendoring of non-go files diff --git a/package/ffi/sdks/go.go b/package/ffi/sdks/go.go index d1cca922..e37980b8 100644 --- a/package/ffi/sdks/go.go +++ b/package/ffi/sdks/go.go @@ -63,6 +63,7 @@ func (s *GoSDK) Build(ctx context.Context, client *dagger.Client, hostDirectory WithExec([]string{"git", "clone", "https://github.com/flipt-io/flipt-client-sdks.git", "/src"}). WithWorkdir("/src"). WithFile("/tmp/ext/flipt_engine.h", hostDirectory.File("flipt-engine-ffi/include/flipt_engine.h")). + WithFile("/tmp/ext/ext.go", hostDirectory.File("flipt-client-go/ext/ext.go")). WithDirectory("/tmp/ext", hostDirectory.Directory(fmt.Sprintf("tmp/%s", s.Libc)), dagger.ContainerWithDirectoryOpts{Include: defaultInclude}) filtered := repository. From cb2e6b9ddf329d94bc17e8e23c11fa3312113b78 Mon Sep 17 00:00:00 2001 From: Mark Phelps <209477+markphelps@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:28:31 -0500 Subject: [PATCH 2/2] chore: 'embed' the entire ext folder in go sdk for vendoring Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com> --- flipt-client-go/{ext => }/ext.go | 4 ++-- package/ffi/sdks/go.go | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) rename flipt-client-go/{ext => }/ext.go (78%) diff --git a/flipt-client-go/ext/ext.go b/flipt-client-go/ext.go similarity index 78% rename from flipt-client-go/ext/ext.go rename to flipt-client-go/ext.go index 22a04681..ac760af0 100644 --- a/flipt-client-go/ext/ext.go +++ b/flipt-client-go/ext.go @@ -1,8 +1,8 @@ -package ext +package evaluation import "embed" -//go:embed *.h +//go:embed ext/* var _ embed.FS // https://github.com/flipt-io/flipt-client-sdks/issues/558 diff --git a/package/ffi/sdks/go.go b/package/ffi/sdks/go.go index e37980b8..d1cca922 100644 --- a/package/ffi/sdks/go.go +++ b/package/ffi/sdks/go.go @@ -63,7 +63,6 @@ func (s *GoSDK) Build(ctx context.Context, client *dagger.Client, hostDirectory WithExec([]string{"git", "clone", "https://github.com/flipt-io/flipt-client-sdks.git", "/src"}). WithWorkdir("/src"). WithFile("/tmp/ext/flipt_engine.h", hostDirectory.File("flipt-engine-ffi/include/flipt_engine.h")). - WithFile("/tmp/ext/ext.go", hostDirectory.File("flipt-client-go/ext/ext.go")). WithDirectory("/tmp/ext", hostDirectory.Directory(fmt.Sprintf("tmp/%s", s.Libc)), dagger.ContainerWithDirectoryOpts{Include: defaultInclude}) filtered := repository.