mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Go: Add integration test for extracting vendored dependencies
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"configuration" : {
|
||||
"go" : { }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
# go get has been observed to sometimes fail when multiple tests try to simultaneously fetch the same package.
|
||||
goget
|
||||
@@ -0,0 +1,5 @@
|
||||
go 1.14
|
||||
|
||||
require example.com/test v0.1.0
|
||||
|
||||
module test
|
||||
@@ -0,0 +1 @@
|
||||
example.com/test v0.1.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
subdir "example.com/test"
|
||||
)
|
||||
|
||||
func Test() {
|
||||
|
||||
foo := subdir.Add(2, 2)
|
||||
println(foo)
|
||||
}
|
||||
5
go/ql/integration-tests/all-platforms/go/extract-vendor/src/vendor/example.com/test/add.go
generated
vendored
Normal file
5
go/ql/integration-tests/all-platforms/go/extract-vendor/src/vendor/example.com/test/add.go
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
func Add(a, b int) int {
|
||||
return a + b
|
||||
}
|
||||
3
go/ql/integration-tests/all-platforms/go/extract-vendor/src/vendor/modules.txt
vendored
Normal file
3
go/ql/integration-tests/all-platforms/go/extract-vendor/src/vendor/modules.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# example.com/test v0.1.0
|
||||
## explicit; go 1.14
|
||||
example.com/test
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
from go_integration_test import *
|
||||
|
||||
os.environ['CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS'] = "true"
|
||||
go_integration_test()
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user