-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Go: fix small issues highlighted by data flow consistency checks #20929
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
Open
owen-mc
wants to merge
4
commits into
github:main
Choose a base branch
from
owen-mc:go/fix-data-flow-consistency-checks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+19
−268
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
go/ql/lib/change-notes/2025-11-26-unexpected-frontend-errors-query-moved.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| --- | ||
| category: breaking | ||
| --- | ||
| * The query `go/unexpected-frontend-error` has been moved from the `codeql/go-queries` query to the `codeql-go-consistency-queries` query pack. | ||
| * The query `go/unexpected-frontend-error` has been moved from the `codeql/go-queries` query to the `codeql-go-consistency-queries` query pack. |
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
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
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
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
3 changes: 0 additions & 3 deletions
3
go/ql/test/example-tests/snippets/CONSISTENCY/DataFlowConsistency.expected
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
go/ql/test/experimental/CWE-400/CONSISTENCY/DataFlowConsistency.expected
This file was deleted.
Oops, something went wrong.
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
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
6 changes: 0 additions & 6 deletions
6
go/ql/test/library-tests/semmle/go/Types/CONSISTENCY/DataFlowConsistency.expected
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,5 @@ | ||
| reverseRead | ||
| | pkg1/embedding.go:56:29:56:39 | implicit dereference | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/embedding.go:57:33:57:46 | implicit dereference | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/embedding.go:58:14:58:22 | implicit read of field embedder | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/embedding.go:58:31:58:42 | implicit read of field embedder | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/tst.go:43:6:43:6 | t | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/tst.go:46:6:46:6 | t | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/tst.go:50:2:50:2 | t | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/tst.go:53:6:53:7 | t2 | Origin of readStep is missing a PostUpdateNode. | | ||
| | pkg1/tst.go:55:6:55:7 | t2 | Origin of readStep is missing a PostUpdateNode. | | ||
| | promoted.go:18:6:18:6 | t | Origin of readStep is missing a PostUpdateNode. | |
37 changes: 0 additions & 37 deletions
37
...tests/semmle/go/dataflow/ExternalFlowInheritance/CONSISTENCY/DataFlowConsistency.expected
This file was deleted.
Oops, something went wrong.
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
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
7 changes: 0 additions & 7 deletions
7
...library-tests/semmle/go/dataflow/PromotedMethods/CONSISTENCY/DataFlowConsistency.expected
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
...ts/semmle/go/dataflow/flowsources/local/database/CONSISTENCY/DataFlowConsistency.expected
This file was deleted.
Oops, something went wrong.
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
2 changes: 0 additions & 2 deletions
2
.../test/library-tests/semmle/go/frameworks/Macaron/CONSISTENCY/DataFlowConsistency.expected
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should this instead be a general rule saying: If we have a post-update node for
a.bthen we also need one fora?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.
Looking more closely, I see that actually we already deal with reads of promoted fields (in
insn = getAWrittenInsn()), and this change is actually about receivers of calls to promoted methods. (I've just updated the description.) To your point, doing that would make the predicate recursive and less transparent. Since I've determined exactly what was missing from the previous definition, I feel like the most straightforward thing is to just add it to the predicate.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.
Ok, as long as the logic covers satisfies the implication I mention above.