Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag trimpath in the go build command #9452

Merged
merged 1 commit into from
Mar 6, 2021

Conversation

pallavJha
Copy link
Contributor

What this PR does / why we need it:
This PR adds the flag -trimpath in the make build and make build-cross.

make build-cross

Helm uses gox to cross compile but gox does not support the -trimpath flag. To add the flag, I've used GOFLAGS="-trimpath" env in the gox command.

make build

The flag has been directly added in the go build command.

This way the directory path, /home/circlei, is trimmed, for example,

with Helm v3.5.2
$ ./helm version
version.BuildInfo{Version:"v3.5.2", GitCommit:"167aac70832d3a384f65f9745335e9fb40169dc2", GitTreeState:"dirty", GoVersion:"go1.15.7"}
$ ./helm install abc . --dry-run --debug
install.go:173: [debug] Original chart version: ""
install.go:190: [debug] CHART PATH: /home/waterbottle/Code/linux-amd64

Error: Chart.yaml file is missing
helm.go:81: [debug] Chart.yaml file is missing
helm.sh/helm/v3/pkg/chart/loader.LoadFiles
        /home/circleci/helm.sh/helm/pkg/chart/loader/load.go:158
helm.sh/helm/v3/pkg/chart/loader.LoadDir
        /home/circleci/helm.sh/helm/pkg/chart/loader/directory.go:119
helm.sh/helm/v3/pkg/chart/loader.DirLoader.Load
        /home/circleci/helm.sh/helm/pkg/chart/loader/directory.go:41
helm.sh/helm/v3/pkg/chart/loader.Load
        /home/circleci/helm.sh/helm/pkg/chart/loader/load.go:62
main.runInstall
        /home/circleci/helm.sh/helm/cmd/helm/install.go:199
main.newInstallCmd.func2
        /home/circleci/helm.sh/helm/cmd/helm/install.go:120
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:850
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:958
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v1.1.1/command.go:895
main.main
        /home/circleci/helm.sh/helm/cmd/helm/helm.go:80
runtime.main
        /usr/local/go/src/runtime/proc.go:204
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1374
with this change:
$ ./helm install abc . --dry-run --debug
install.go:173: [debug] Original chart version: ""
install.go:190: [debug] CHART PATH: /home/waterbottle/Code/helm-pallav/_dist/linux-amd64

Error: Chart.yaml file is missing
helm.go:81: [debug] Chart.yaml file is missing
helm.sh/helm/v3/pkg/chart/loader.LoadFiles
        helm.sh/helm/v3/pkg/chart/loader/load.go:158
helm.sh/helm/v3/pkg/chart/loader.LoadDir
        helm.sh/helm/v3/pkg/chart/loader/directory.go:119
helm.sh/helm/v3/pkg/chart/loader.DirLoader.Load
        helm.sh/helm/v3/pkg/chart/loader/directory.go:41
helm.sh/helm/v3/pkg/chart/loader.Load
        helm.sh/helm/v3/pkg/chart/loader/load.go:62
main.runInstall
        helm.sh/helm/v3/cmd/helm/install.go:199
main.newInstallCmd.func2
        helm.sh/helm/v3/cmd/helm/install.go:120
github.com/spf13/cobra.(*Command).execute
        github.com/spf13/cobra@v1.1.1/command.go:850
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/cobra@v1.1.1/command.go:958
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/cobra@v1.1.1/command.go:895
main.main
        helm.sh/helm/v3/cmd/helm/helm.go:80
runtime.main
        runtime/proc.go:204
runtime.goexit
        runtime/asm_amd64.s:1374

Special notes for your reviewer:

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Signed-off-by: Pallav Jha <pallav_kumar71@yahoo.com>
Signed-off-by: pallavJha <pallav_kumar71@yahoo.com>
@helm-bot helm-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 6, 2021
@bacongobbler bacongobbler merged commit 6e4a61f into helm:master Mar 6, 2021
@bacongobbler bacongobbler added this to the 3.6.0 milestone Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants