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

Go: Add language-specific baseline configuration #13846

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Jul 30, 2023

No description provided.

@owen-mc owen-mc requested a review from a team as a code owner July 30, 2023 20:53
@github-actions github-actions bot added the Go label Jul 30, 2023
smowton
smowton previously approved these changes Jul 31, 2023
@owen-mc
Copy link
Contributor Author

owen-mc commented Jul 31, 2023

@smowton Note that CI failed because it found Go 1.20.5 in the cache and used that 😞 . This is the first time I've seen 1.20.5 since 1.20.6 started being used.

Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

Could we modify these scripts to return a JSON object in all cases (for instance, just an empty array for paths-ignore)? Right now the CLI will tolerate the output, but will raise a warning that the script didn't return a valid baseline configuration.

@henrymercer
Copy link
Contributor

@smowton Note that CI failed because it found Go 1.20.5 in the cache and used that 😞 . This is the first time I've seen 1.20.5 since 1.20.6 started being used.

The toolcache version used in an Actions run on a repo isn't monotonic, and can wobble during the rollout of a new version of the toolcache. So it might be an idea to set up a specific patch version of Go, if the tests rely on that.

@owen-mc
Copy link
Contributor Author

owen-mc commented Jul 31, 2023

@henrymercer Sure. Done (though the new commit that I've pushed isn't showing up yet - maybe a short delay?). Note that I wasn't sure whether to put this in tool or codeql-tools. I guess the proof of the pudding is in the eating, but I haven't had a chance to test this yet.

@henrymercer
Copy link
Contributor

Looking at the Makefile, codeql-tools looks like the right place, though we might need to add the scripts to the CODEQL_TOOLS variable in the Makefile too.

@henrymercer
Copy link
Contributor

I looked at your branch and it looks good, except I think go/codeql-tools/baseline-config-vendor.json and go/codeql-tools/baseline-config-empty.json are swapped. Not sure why we can't see the commit in the PR.

henrymercer
henrymercer previously approved these changes Jul 31, 2023
Copy link
Contributor

@henrymercer henrymercer left a comment

Choose a reason for hiding this comment

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

I built an intree dist for Go and tested this on a repo with vendored modules. After making the modifications below, it worked 🎉:

> codeql database init path/to/db --source-root path/to/source --language go -vvv --calculate-language-specific-baseline
...
Ignored an additional 2516 files when processing baseline information for Go due to paths and paths-ignore configuration.
Found 1254 baseline files for go.
...

go/codeql-tools/configure-baseline.cmd Outdated Show resolved Hide resolved
go/codeql-tools/configure-baseline.sh Outdated Show resolved Hide resolved
Co-authored-by: Henry Mercer <henry.mercer@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants