tanzu-cli
tanzu-cli copied to clipboard
Enable escape of space in goflag value
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 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 \
Which issue(s) this PR fixes
Fixes #
Describe testing done for PR
manually tested:
make quick-install
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 ..." --goflags "-gcflags=all=-N\ -l" --os-arch darwin_arm64 --debug-symbols=true
2024-07-01T16:32:04-07:00 [i] building local repository at /Users/vuichiap/apps-cli-plugin/artifacts/plugins, v0.1.0-beta.2-dev-7c55b6f6, [darwin_arm64]
2024-07-01T16:32:04-07:00 [i] 🐼 - building plugin at path "cmd/plugin/apps"
2024-07-01T16:32:09-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:32:15-07:00 [i] ========
2024-07-01T16:32:15-07:00 [i] saving plugin manifest...
2024-07-01T16:32:15-07:00 [ok] successfully built local repository
tanzu plugin install appsv2 --version v0.1.0-beta.2-dev-7c55b6f6 --local-source /Users/vuichiap/apps-cli-plugin/artifacts/plugins/darwin/arm64
[i] Installed plugin 'appsv2:v0.1.0-beta.2-dev-7c55b6f6' with target 'global'
[ok] successfully installed 'appsv2' plugin
Release note
builder plugin: plugin compile supports escape of space in goflag value