File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 4444 - name : Checkout repository
4545 uses : actions/checkout@v4
4646
47+ - name : Workspace Init
48+ run : make workspace-init
49+
4750 - name : Unit Test
4851 run : make unit-test
4952
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ jobs:
122122 with :
123123 go-version : ${{ env.DEFAULT_GO_VERSION }}
124124 - run : |
125+ make workspace-init
125126 go mod tidy
126127 make controller-gen
127128 IMG=ghcr.io/open-feature/open-feature-operator:${{ needs.release-please.outputs.release_tag_name }} make helm-package
Original file line number Diff line number Diff line change @@ -5,9 +5,6 @@ WORKDIR /workspace
55# Copy the Go Modules manifests
66COPY go.mod go.mod
77COPY go.sum go.sum
8- # cache deps before building and copying source so that we don't need to re-download as much
9- # and so that source changes don't invalidate our downloaded layer
10- RUN go mod download
118
129# Copy the go source
1310COPY main.go main.go
@@ -16,6 +13,10 @@ COPY webhooks/ webhooks/
1613COPY controllers/ controllers/
1714COPY common/ common/
1815
16+ # cache deps before building and copying source so that we don't need to re-download as much
17+ # and so that source changes don't invalidate our downloaded layer
18+ RUN go work init . ./apis && go mod download
19+
1920ARG TARGETOS
2021ARG TARGETARCH
2122
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ CHART_VERSION=v0.5.4# x-release-please-version
1111ENVTEST_K8S_VERSION = 1.26.1
1212WAIT_TIMEOUT_SECONDS? =60
1313
14+ ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
15+
1416# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
1517ifeq (,$(shell go env GOBIN) )
1618GOBIN =$(shell go env GOPATH) /bin
@@ -256,3 +258,13 @@ install-mockgen:
256258 go install github.com/golang/mock/
[email protected] 257259mockgen : install-mockgen
258260 mockgen -source=controllers/common/flagd-injector.go -destination=controllers/common/mock/flagd-injector.go -package=commonmock
261+
262+ workspace-init : workspace-clean
263+ go work init
264+ $(foreach module, $(ALL_GO_MOD_DIRS ) , go work use $(module ) ;)
265+
266+ workspace-update :
267+ $(foreach module, $(ALL_GO_MOD_DIRS ) , go work use $(module ) ;)
268+
269+ workspace-clean :
270+ rm -rf go.work
You can’t perform that action at this time.
0 commit comments