FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Install wrapper script for Go on Linux to support tracing for Go 1.21 and above by mbg · Pull Request #1909 · github/codeql-action · GitHub

Install wrapper script for Go on Linux to support tracing for Go 1.21 and above - #1909

Merged
mbg merged 29 commits into
mainfrom
mbg/go-1.21-workaround
Oct 5, 2023
Merged

mbg merged 29 commits into
mainfrom
mbg/go-1.21-workaround

Conversation

mbg commented Sep 28, 2023
edited
Loading

Copy link
Copy Markdown
Member

This PR modifies the init Action to add a go wrapper script to the PATH if we are running on Linux in order to better cope with tracing builds for Go 1.21 and above. This works as follows:

  • If we are initialising CodeQL for Go and we are running on Linux, then we obtain the current path to the go binary.
  • We query the type of executable with the file command.
  • If this contains the string "statically linked", we install the wrapper script to a bin directory in the CodeQL temporary directory.
  • We add that bin directory to the system PATH
  • We store the location of the wrapper script in a new environment variable, CODEQL_ACTION_GO_BINARY (we could probably omit this since the path can be reconstructed in the analyze step)

Additionally, we verify that the result of which go points to our wrapper script in the analyze step by checking it against the value of CODEQL_ACTION_GO_BINARY to make sure that users did not e.g. use a setup-go step after the init action.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

Comment thread src/actions-util.ts Outdated
Comment thread src/actions-util.ts
Comment thread src/analyze-action.ts Outdated
mbg changed the title Use Go 1.21 for Go tracing checks Install wrapper script for Go on Linux to support tracing for Go 1.21 and above Sep 28, 2023
mbg force-pushed the mbg/go-1.21-workaround branch from b5e2270 to d4722a8 Compare September 28, 2023 11:24
mbg marked this pull request as ready for review September 28, 2023 11:35
mbg requested a review from a team as a code owner September 28, 2023 11:35

criemen commented Sep 28, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

Can we already add a feature gate/version flag to that, so that we automatically stop this wrapper script installation at some point in the future? Or a turn-off switch from the CLI?
Once we fix this in the CLI, we need to be able to retrospectively turn off this hack from the CLI, otherwise we'll extract go files with older codeql-action versions double.

Edit: Maybe we can use the new version feature already?

smowton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This broadly looks good but still needs some sort of version gating mechanism so that we don't start double-tracing if and when the CLI starts handling this situation for itself.

mbg force-pushed the mbg/go-1.21-workaround branch from 5933ae0 to 0696c1b Compare October 4, 2023 16:40

henrymercer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

As a general comment, are we happy with the test coverage here? Specifically, do we want to add some unit tests or some specific assertions to the PR checks? Or do the existing checks passing on Go 1.21.1 give us enough confidence?

Comment thread src/actions-util.ts Outdated
Comment thread src/actions-util.ts
Comment thread src/analyze-action.ts Outdated
Comment thread src/actions-util.ts Outdated
Comment thread src/init-action.ts
Comment thread src/init-action.ts Outdated
Comment thread src/init-action.ts Outdated
Comment thread src/resolve-environment.test.ts.ignore Outdated
Comment thread src/tools-features.ts Outdated
mbg force-pushed the mbg/go-1.21-workaround branch from 0696c1b to 68d0b65 Compare October 4, 2023 19:03

henrymercer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, I'd like to hear what Chris thinks about how we should behave in the absence of file, but otherwise this looks good to me.

henrymercer previously approved these changes Oct 5, 2023
mbg force-pushed the mbg/go-1.21-workaround branch from 31af127 to faf7528 Compare October 5, 2023 12:11
mbg requested review from henrymercer and smowton October 5, 2023 13:09
henrymercer previously approved these changes Oct 5, 2023

henrymercer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Very nice!

Comment thread src/analyze-action.ts Outdated
Comment thread src/analyze-action.ts Outdated
mbg and others added 2 commits October 5, 2023 14:27
Co-authored-by: Henry Mercer <henry.mercer@me.com>
mbg force-pushed the mbg/go-1.21-workaround branch from cb79d4d to 235bdca Compare October 5, 2023 13:27
mbg merged commit 1ea6a10 into main Oct 5, 2023
mbg deleted the mbg/go-1.21-workaround branch October 5, 2023 14:31
github-actions Bot mentioned this pull request Oct 6, 2023
6 tasks
mbg mentioned this pull request Oct 13, 2023
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL