From e4d0b2ca22416308bae4d030a8bf1e513c18c9f2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 17 Jan 2024 01:21:22 -0500 Subject: [PATCH 1/7] feat: use go.work for development purposes This makes it so we don't have to fake download dependencies for development, allowing for a better experience in your local editor. --- go.work | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 go.work diff --git a/go.work b/go.work new file mode 100644 index 000000000..ff476b8fc --- /dev/null +++ b/go.work @@ -0,0 +1,24 @@ +go 1.21.3 + +use ( + ./plugins/app-json + ./plugins/apps + ./plugins/builder + ./plugins/buildpacks + ./plugins/common + ./plugins/config + ./plugins/cron + ./plugins/docker-options + ./plugins/logs + ./plugins/network + ./plugins/nginx-vhosts + ./plugins/ports + ./plugins/proxy + ./plugins/ps + ./plugins/registry + ./plugins/repo + ./plugins/resource + ./plugins/scheduler + ./plugins/scheduler-docker-local + ./plugins/scheduler-k3s +) From ddfedfa018cd56dd1f9e8e708caca3efb2e6bafd Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 17 Jan 2024 01:22:07 -0500 Subject: [PATCH 2/7] chore: drop installing go modules via go get This is no longer necessary with the introduction of the go.work file. --- .devcontainer/bin/setup-dev-env | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.devcontainer/bin/setup-dev-env b/.devcontainer/bin/setup-dev-env index fab9f2b30..9c7983cef 100755 --- a/.devcontainer/bin/setup-dev-env +++ b/.devcontainer/bin/setup-dev-env @@ -5,27 +5,6 @@ install-go-devtools() { go install honnef.co/go/tools/cmd/staticcheck@latest } -install-go-mods() { - local plugin_root="/root/go/src/github.com/dokku/dokku/plugins" - - export GO111MODULE=off - echo "-----> Fetching onsi/gomega dependency for tests" - go get github.com/onsi/gomega || true - - echo "-----> Fetching spf13/pflag dependency for subcommands" - go get github.com/spf13/pflag || true - pushd "$plugin_root" >/dev/null || true - find "$plugin_root/" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read -r plugin; do - pushd "$plugin_root/$plugin" >/dev/null || true - if [[ -f "go.mod" ]]; then - echo "-----> Fetching dependencies for $plugin plugin" - go get || true - fi - popd >/dev/null || true - done - popd >/dev/null || true -} - setup-ci() { local dokku_root="/root/go/src/github.com/dokku/dokku" pushd "$plugin_root" >/dev/null || true @@ -34,7 +13,6 @@ setup-ci() { } main() { - install-go-mods install-go-devtools setup-ci } From 066dc29549ceedeb56aa8581b9f6dbb51f90b736 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 17 Jan 2024 01:22:25 -0500 Subject: [PATCH 3/7] fix: drop missing plugin from go.work file --- go.work | 1 - 1 file changed, 1 deletion(-) diff --git a/go.work b/go.work index ff476b8fc..1c95854bd 100644 --- a/go.work +++ b/go.work @@ -20,5 +20,4 @@ use ( ./plugins/resource ./plugins/scheduler ./plugins/scheduler-docker-local - ./plugins/scheduler-k3s ) From 85918a9f993d64ec04222686e105b036f253d3c2 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 17 Jan 2024 01:27:06 -0500 Subject: [PATCH 4/7] chore: disable go workfiles during builds --- common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.mk b/common.mk index 1f96c4cec..739293ea5 100644 --- a/common.mk +++ b/common.mk @@ -21,7 +21,7 @@ build-in-docker: clean -e GO111MODULE=on \ -w $(GO_REPO_ROOT)/plugins/$(PLUGIN_NAME) \ $(BUILD_IMAGE) \ - bash -c "GO_ARGS='$(GO_ARGS)' CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) make -j4 $(GO_PLUGIN_MAKE_TARGET)" || exit $$? + bash -c "GO_ARGS='$(GO_ARGS)' CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) GOWORK=off make -j4 $(GO_PLUGIN_MAKE_TARGET)" || exit $$? clean: rm -rf $(BUILD) From b1a7032e9f536dcfb0a5b6f89987c9e64c142972 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 17 Jan 2024 01:40:32 -0500 Subject: [PATCH 5/7] fix: correct format of go version in go.work file --- go.work | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.work b/go.work index 1c95854bd..b0eb4a0e6 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.21.3 +go 1.21 use ( ./plugins/app-json From 9b4a376f68b82ecb27441e29a09537dcc145c643 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 17 Jan 2024 01:51:11 -0500 Subject: [PATCH 6/7] fix: delete go.work file to resolve codeql issue CodeQL doesn't currently support go.work files. See https://github.com/github/codeql/issues/14235 for details. --- .github/workflows/codeql-analysis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ffb84b12d..404b4cd5c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -66,9 +66,9 @@ jobs: # and modify them (or add more) to build your code if your project # uses a compiled language - # - run: | - # make bootstrap - # make release + # workaround for https://github.com/github/codeql/issues/14235 + - name: Remove go.work file + run: rm go.work - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 From af9dc4604ad1d8c0f7fd19f0f6b426158852beec Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Wed, 17 Jan 2024 01:58:37 -0500 Subject: [PATCH 7/7] fix: remove go.work file earlier --- .github/workflows/codeql-analysis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 404b4cd5c..d6eb956ec 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -44,6 +44,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + # workaround for https://github.com/github/codeql/issues/14235 + - name: Remove go.work file + run: rm go.work + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v3 @@ -66,9 +70,5 @@ jobs: # and modify them (or add more) to build your code if your project # uses a compiled language - # workaround for https://github.com/github/codeql/issues/14235 - - name: Remove go.work file - run: rm go.work - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3