Skip to content

Commit

Permalink
Merge pull request #1716 from debasishbsws/fix-go-build-pl
Browse files Browse the repository at this point in the history
go/build pipeline: Move `go mod tidy` after `cd` to `modroot` dir AND Validate existence of `go.mod` in `modroot`
  • Loading branch information
debasishbsws authored Jan 6, 2025
2 parents a37b11a + cb6b143 commit 8065e4c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/build/pipelines/go/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,23 @@ inputs:

pipeline:
- runs: |
cd "${{inputs.modroot}}"
# check if modroot is set correctly by checking go.mod file exist
if [ ! -e go.mod ]; then
echo "go.mod not found in ${{inputs.modroot}}"
exit 1
fi
"${{inputs.tidy}}" && go mod tidy
LDFLAGS="${{inputs.strip}} ${{inputs.ldflags}}"
BASE_PATH="${{inputs.prefix}}/${{inputs.install-dir}}/${{inputs.output}}"
# Take advantage of melange's buid cache for downloaded modules
export GOMODCACHE=/var/cache/melange/gomodcache
cd "${{inputs.modroot}}"
# Install any specified dependencies
if [ ! "${{inputs.deps}}" == "" ]; then
for dep in ${{inputs.deps}}; do
Expand Down

0 comments on commit 8065e4c

Please sign in to comment.