Skip to content

Commit d6712b2

Browse files
committed
Add test for unexpected directory layout error
1 parent 8356991 commit d6712b2

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"markdownMessage": "You should replace relative package paths (that contain `.` or `..`) with absolute paths. Alternatively you can [use a Go module](https://go.dev/blog/using-go-modules).",
3+
"severity": "error",
4+
"source": {
5+
"extractorName": "go",
6+
"id": "go/autobuilder/relative-import-paths",
7+
"name": "Some imports use unsupported relative package paths"
8+
},
9+
"visibility": {
10+
"cliSummaryTable": true,
11+
"statusPage": true,
12+
"telemetry": true
13+
}
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import sys
2+
3+
from create_database_utils import *
4+
from diagnostics_test_utils import *
5+
6+
os.environ['GITHUB_REPOSITORY'] = "a/b"
7+
run_codeql_database_create([], lang="go", source="work", db=None, runFunction=runUnsuccessfully)
8+
9+
check_diagnostics()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import (
4+
"./subpkg"
5+
)
6+
7+
func main() {
8+
subpkg.F()
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package subpkg
2+
3+
import "fmt"
4+
5+
func F() {
6+
// It is required that there is an import in this package, which is import by another package using a local path
7+
fmt.Println("subpkg.F")
8+
}

0 commit comments

Comments
 (0)