Skip to content
Snippets Groups Projects
Commit b08bf371 authored by Kai's avatar Kai Committed by Kai Ehrhardt
Browse files

fix: resolve build mode based on package main appearance

further information: https://go.dev/doc/code
parent 3f7c6c3c
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ variables:
-mod=readonly
# Default flags for go build linker
GO_BUILD_LINKER_FLAGS: "-s -w"
GO_BUILD_LINKER_FLAGS: "-s -w"
# Default packages for 'build' command
GO_BUILD_PACKAGES: >-
......@@ -151,12 +151,12 @@ stages:
}
function go_build_auto() {
log_info "auto build mode, looking up for a \\e[33;1mmain.go\\e[0m file..."
found_main_go=$(find ./ -name 'main.go' | wc -l)
if [ "${found_main_go}" -eq 0 ]; then
go_build_modules
else
log_info "auto build mode, looking up for a \\e[33;1mmain\\e[0m package..."
if grep -Rw --include "*.go" "^package main"
then
go_build_application
else
go_build_modules
fi
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment