-
Notifications
You must be signed in to change notification settings - Fork 69
🐛 Fix knative.dev/toolbox for older versions of Golang #436
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
🐛 Fix knative.dev/toolbox for older versions of Golang #436
Conversation
This commit introduces a new shell helper function, `resolve_dep_version`, which retrieves the version of a specified Go module from the project's `go.mod` file. As part of this change: - All usages of `knative.dev/toolbox/...@latest` have been pinned to a specific commit (`@bc7e152`) to ensure reproducible builds and prevent unexpected failures due to upstream changes. - The shell script test harness has been improved to more reliably locate the `go` executable, making the tests more robust across different environments.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cardil The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The `go_run` helper function is updated to set `GOTOOLCHAIN=auto` when executing toolbox tools.
33d9abf to
e9d3c22
Compare
|
/assign @maschmid |
|
/cc @maschmid |
This change corrects the logic to set `GOTOOLCHAIN=auto` for any package within the `knative.dev/toolbox` module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes compatibility issues with older versions of Golang by automatically setting GOTOOLCHAIN=auto for knative.dev/toolbox tools. This allows Go to fetch remote dependencies with newer Go versions when needed.
- Adds automatic GOTOOLCHAIN=auto environment variable for knative.dev/toolbox tools
- Updates test infrastructure to handle Go toolchain switching messages and improve binary detection
- Refactors test loops to use modern Go range syntax
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| library.sh | Adds GOTOOLCHAIN=auto setting for knative.dev/toolbox packages in go_run function |
| presubmit-tests.sh | Updates to use go_run wrapper instead of direct go run |
| test/unit/sharedlib_test.go | Enhances test infrastructure with better executable finding and Go toolchain message filtering |
| test/unit/update_deps_test.go | Modernizes for loop syntax from index-based to range-based |
| test/unit/report_go_test.go | Modernizes for loop syntax from index-based to range-based |
| test/unit/release_test.go | Modernizes for loop syntax from index-based to range-based |
| test/unit/presubmit_test.go | Modernizes for loop syntax from index-based to range-based |
| test/unit/codegen_test.go | Modernizes for loop syntax from index-based to range-based |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This commit makes two corrections to the test suite in `sharedlib_test.go`: 1. In the main test runner, the `errOut` variable (which captures stderr) was incorrectly being checked against the `outputTypeStdout` constant. This has been corrected to `outputTypeStderr` to ensure test failure messages accurately reflect the stream being checked. 2. Potential errors from `io.ReadAll` when capturing stdout and stderr in the `goRunHelpPrefetcher` were being ignored. Assertions have been added to ensure that any errors during these reads are caught, making the test more robust.
4b16d14 to
ce37357
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| if m.IsDir() { | ||
| return syscall.EISDIR | ||
| } | ||
| if m&0111 != 0 { |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 0111 (octal for executable permission bits) should be defined as a named constant like executablePermMask = 0111 to improve code readability and maintainability.
|
/lgtm |
|
/cherrypick release-1.15 |
|
@cardil: #436 failed to apply on top of branch "release-1.15": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherrypick release-1.15 |
|
@cardil: new pull request created: #440 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherrypick release-1.16 |
|
@cardil: new pull request created: #441 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@cardil: new pull request created: #442 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@cardil: new pull request created: #443 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@cardil: new pull request created: #444 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Changes
This allows Go to automatically fetch a remote
go rundep with a newer version of golang, if needed. This should be okay, as those tools are development only, and not used in production code./kind bug
Fixes #426
Release Note