The Tanzu Core CLI project provides the core functionality of the Tanzu CLI. The CLI is based on a plugin architecture where CLI command functionality can be delivered through independently developed plugin binaries
This change fixes the issue that occurs when --goflags is passing a value with a space in it.
The code prior to the fix is such that no amount of escaping of the space will enable the proper processing of the parameter
tanzu builder plugin build --path ./cmd/plugin --binary-artifacts /Users/vuichiap/apps-cli-plugin/artifacts/plugins --version v0.1.0-beta.2-dev-7c55b6f6 --ldflags "-X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=$(date -u +"%Y-%m-%d")' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=7c55b6f6dc6e34f7e5ef63ad579891432a9ca507' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v0.1.0-beta.2-dev-7c55b6f6'" --goflags "-gcflags=all=-N -l" --os-arch darwin_arm64 --debug-symbols=true
2024-07-01T16:29:26-07:00 [i] 🐼 - $ /usr/local/go/bin/go build -gcflags=all=-l -gcflags=all=-N -l -o /Users/vuichiap/apps-cli-plugin/artifacts/plugins/darwin/arm64/global/appsv2/v0.1.0-beta.2-dev-7c55b6f6/tanzu-appsv2-darwin_arm64 -ldflags -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Date=2024-07-01' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.SHA=7c55b6f6dc6e34f7e5ef63ad579891432a9ca507' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v0.1.0-beta.2-dev-7c55b6f6' -X 'github.com/vmware-tanzu/tanzu-plugin-runtime/plugin/buildinfo.Version=v0.1.0-beta.2-dev-7c55b6f6' -tags ./cmd/plugin/apps
2024-07-01T16:29:26-07:00 [x] - error: exit status 2
2024-07-01T16:29:26-07:00 [x] - output: flag provided but not defined: -l
usage: go build [-o output] [build flags] [packages]
Run 'go help build' for details.
The fix is to support escaping of any space character with a preceding \
What this PR does / why we need it
This change fixes the issue that occurs when
--goflags
is passing a value with a space in it. The code prior to the fix is such that no amount of escaping of the space will enable the proper processing of the parameterThe fix is to support escaping of any space character with a preceding
\
Which issue(s) this PR fixes
Fixes #
Describe testing done for PR
manually tested:
Release note
Additional information
Special notes for your reviewer