#1587 - Fix: Remove temporary Go tools directory#1588
#1587 - Fix: Remove temporary Go tools directory#1588gvatsal60 wants to merge 4 commits intodevcontainers:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the Go feature’s tool-install flow to ensure the temporary GOPATH directory used for building Go tools is handled consistently and fully cleaned up, addressing reported leftover cache/module artifacts in built images.
Changes:
- Switches GOCACHE to be derived from GOPATH (
${GOPATH}/cache) and uses${GOPATH}consistently for temp directory operations. - Moves installed tool binaries from
${GOPATH}/bininto${TARGET_GOPATH}/bin. - Adds an unconditional cleanup step to remove the temporary Go tools directory after tool and golangci-lint installation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Hi @gvatsal60
Thank you for the contribution. Would you please bump the go feature version and is there any problem you foresee with implementing this suggestion?
Hi @Kaniska244 , Thanks for the review! |
Issue: #1587
This pull request refactors the Go tools installation process in
src/go/install.shto improve directory handling and cleanup. The changes mainly focus on using a consistent temporary directory for Go tools, updating environment variables, and ensuring proper cleanup after installation.Improvements to directory management and environment variables:
GOPATHvariable consistently, updated theGOCACHEassignment, and ensured all related directories are created before use.${GOPATH}/binpath instead of a hardcoded/tmp/gotools/binpath.Cleanup enhancements:
${GOPATH}) after installation is complete, ensuring no leftover files remain.