Skip to content

Commit

Permalink
Merge pull request #991 from lyoung-confluent/patch-1
Browse files Browse the repository at this point in the history
feat: GOEXPERIMENT support to go/build and go/install pipelines
  • Loading branch information
imjasonh authored Feb 7, 2024
2 parents 2c564fd + db75f58 commit 93fe476
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion pkg/build/pipelines/go/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ inputs:
description: |
space separated list of go modules to update before building. example: github.com/foo/[email protected]
experiments:
description: |
A comma-separated list of Golang experiment names (ex: loopvar) to use
when building the binary.
default: ""

pipeline:
- runs: |
TAGS=""
Expand Down Expand Up @@ -98,4 +104,4 @@ pipeline:
[ -e /home/build/go.mod.local ] && cp /home/build/go.mod.local go.mod
[ -e /home/build/go.sum.local ] && cp /home/build/go.sum.local go.sum
go build -o "${{targets.contextdir}}"/${BASE_PATH} -tags "${TAGS}" -ldflags "${LDFLAGS}" -trimpath ${{inputs.packages}}
GOEXPERIMENT="${{inputs.experiments}}" go build -o "${{targets.contextdir}}"/${BASE_PATH} -tags "${TAGS}" -ldflags "${LDFLAGS}" -trimpath ${{inputs.packages}}
9 changes: 8 additions & 1 deletion pkg/build/pipelines/go/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ inputs:
description: |
A comma-separated list of build tags to pass to the go compiler
experiments:
description: |
A comma-separated list of Golang experiment names (ex: loopvar) to use
when building the binary.
default: ""

pipeline:
- runs: |
TAGS=""
Expand All @@ -62,8 +68,9 @@ pipeline:
VERSION="@${{inputs.version}}"
fi
# Run go install
go install ${DEST_PATH} -tags "${TAGS}" -ldflags "${LDFLAGS}" ${{inputs.package}}${VERSION}
GOEXPERIMENT="${{inputs.experiments}}" go install ${DEST_PATH} -tags "${TAGS}" -ldflags "${LDFLAGS}" ${{inputs.package}}${VERSION}
mkdir -p ${{targets.contextdir}}/${{inputs.prefix}}/${{inputs.install-dir}}
# Move all resulting files to the target dir
Expand Down

0 comments on commit 93fe476

Please sign in to comment.