Merge pull request #6429 from dokku/josegonzalez-patch-1

feat: use go.work for development purposes
This commit is contained in:
Jose Diaz-Gonzalez
2024-01-17 02:20:59 -05:00
committed by GitHub
4 changed files with 28 additions and 27 deletions

View File

@@ -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
}

View File

@@ -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
# - run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

View File

@@ -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)

23
go.work Normal file
View File

@@ -0,0 +1,23 @@
go 1.21
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
)