-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16925 from github/mbg/go/add-vendor-env-var
Go: Add environment variable to include `vendor` directories in extraction
- Loading branch information
Showing
12 changed files
with
77 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
5 changes: 5 additions & 0 deletions
5
go/ql/integration-tests/all-platforms/go/extract-vendor/build-environment.expected
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"configuration" : { | ||
"go" : { } | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
go/ql/integration-tests/all-platforms/go/extract-vendor/diagnostics.expected
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"markdownMessage": "A single `go.mod` file was found.\n\n`go.mod`", | ||
"severity": "note", | ||
"source": { | ||
"extractorName": "go", | ||
"id": "go/autobuilder/single-root-go-mod-found", | ||
"name": "A single `go.mod` file was found in the root" | ||
}, | ||
"visibility": { | ||
"cliSummaryTable": false, | ||
"statusPage": false, | ||
"telemetry": true | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
go/ql/integration-tests/all-platforms/go/extract-vendor/force_sequential_test_execution
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package. | ||
goget |
5 changes: 5 additions & 0 deletions
5
go/ql/integration-tests/all-platforms/go/extract-vendor/src/go.mod
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
go 1.14 | ||
|
||
require example.com/test v0.1.0 | ||
|
||
module test |
1 change: 1 addition & 0 deletions
1
go/ql/integration-tests/all-platforms/go/extract-vendor/src/go.sum
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
example.com/test v0.1.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= |
11 changes: 11 additions & 0 deletions
11
go/ql/integration-tests/all-platforms/go/extract-vendor/src/test.go
This file contains 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package test | ||
|
||
import ( | ||
subdir "example.com/test" | ||
) | ||
|
||
func Test() { | ||
|
||
foo := subdir.Add(2, 2) | ||
println(foo) | ||
} |
5 changes: 5 additions & 0 deletions
5
go/ql/integration-tests/all-platforms/go/extract-vendor/src/vendor/example.com/test/add.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
go/ql/integration-tests/all-platforms/go/extract-vendor/src/vendor/modules.txt
This file contains 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# example.com/test v0.1.0 | ||
## explicit; go 1.14 | ||
example.com/test |
5 changes: 5 additions & 0 deletions
5
go/ql/integration-tests/all-platforms/go/extract-vendor/test.expected
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extractedFiles | ||
| src/go.mod:0:0:0:0 | src/go.mod | | ||
| src/test.go:0:0:0:0 | src/test.go | | ||
| src/vendor/example.com/test/add.go:0:0:0:0 | src/vendor/example.com/test/add.go | | ||
#select |
4 changes: 4 additions & 0 deletions
4
go/ql/integration-tests/all-platforms/go/extract-vendor/test.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from go_integration_test import * | ||
|
||
os.environ['CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS'] = "true" | ||
go_integration_test() |
8 changes: 8 additions & 0 deletions
8
go/ql/integration-tests/all-platforms/go/extract-vendor/test.ql
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import go | ||
import semmle.go.DiagnosticsReporting | ||
|
||
query predicate extractedFiles(File f) { any() } | ||
|
||
from string msg, int sev | ||
where reportableDiagnostics(_, msg, sev) | ||
select msg, sev |