Skip to content

Commit 47e6d37

Browse files
committed
Fix absolute path removal on windows
1 parent 8269bff commit 47e6d37

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| Extraction failed in subdir/test.go with error cannot find package "subdir/subsubdir" in any of:\n\t(absolute path)/src/subdir/subsubdir (from $GOROOT)\n\t(absolute path)/src/subdir/subsubdir (from $GOPATH) | 2 |
1+
| Extraction failed in subdir/test.go with error cannot find package "subdir/subsubdir" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH) | 2 |
22
| Extraction failed in subdir/test.go with error could not import subdir/subsubdir (invalid package name: "") | 2 |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| Extraction failed in modules/subdir1/test.go with error cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOROOT)\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOPATH) | 2 |
1+
| Extraction failed in modules/subdir1/test.go with error cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH) | 2 |
22
| Extraction failed in modules/subdir1/test.go with error could not import subdir1/subsubdir1 (invalid package name: "") | 2 |
3-
| Extraction failed in modules/subdir2/test.go with error cannot find package "subdir2/subsubdir2" in any of:\n\t(absolute path)/src/subdir2/subsubdir2 (from $GOROOT)\n\t(absolute path)/src/subdir2/subsubdir2 (from $GOPATH) | 2 |
3+
| Extraction failed in modules/subdir2/test.go with error cannot find package "subdir2/subsubdir2" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH) | 2 |
44
| Extraction failed in modules/subdir2/test.go with error could not import subdir2/subsubdir2 (invalid package name: "") | 2 |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| Extraction failed in subdir0/subdir1/test.go with error cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOROOT)\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOPATH) | 2 |
1+
| Extraction failed in subdir0/subdir1/test.go with error cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH) | 2 |
22
| Extraction failed in subdir0/subdir1/test.go with error could not import subdir1/subsubdir1 (invalid package name: "") | 2 |
3-
| Extraction failed in subdir0/test.go with error cannot find package "test/subdir2" in any of:\n\t(absolute path)/src/test/subdir2 (from $GOROOT)\n\t(absolute path)/src/test/subdir2 (from $GOPATH) | 2 |
3+
| Extraction failed in subdir0/test.go with error cannot find package "test/subdir2" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH) | 2 |
44
| Extraction failed in subdir0/test.go with error could not import test/subdir2 (invalid package name: "") | 2 |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| Extraction failed in subdir1/test.go with error cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOROOT)\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOPATH) | 2 |
1+
| Extraction failed in subdir1/test.go with error cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH) | 2 |
22
| Extraction failed in subdir1/test.go with error could not import subdir1/subsubdir1 (invalid package name: "") | 2 |
3-
| Extraction failed in subdir2/test.go with error cannot find package "subdir2/subsubdir2" in any of:\n\t(absolute path)/src/subdir2/subsubdir2 (from $GOROOT)\n\t(absolute path)/src/subdir2/subsubdir2 (from $GOPATH) | 2 |
3+
| Extraction failed in subdir2/test.go with error cannot find package "subdir2/subsubdir2" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH) | 2 |
44
| Extraction failed in subdir2/test.go with error could not import subdir2/subsubdir2 (invalid package name: "") | 2 |

go/ql/lib/semmle/go/DiagnosticsReporting.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ private class Diagnostic extends @diagnostic {
3838
bindingset[msg]
3939
private string removeAbsolutePaths(string msg) {
4040
exists(string r |
41-
// turn
41+
// turn both
4242
// cannot find package "subdir1/subsubdir1" in any of:\n\t/usr/local/Cellar/go/1.20.5/libexec/src/subdir1/subsubdir1 (from $GOROOT)\n\t/Users/owen-mc/go/src/subdir1/subsubdir1 (from $GOPATH)
43+
// and
44+
// cannot find package "subdir1/subsubdir1" in any of:\n\tC:\\hostedtoolcache\\windows\\go\\1.20.5\\x64\\src\\subdir1\\subsubdir1 (from $GOROOT)\n\tC:\\Users\\runneradmin\\go\\src\\subdir1\\subsubdir1 (from $GOPATH)
4345
// into
44-
// cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOROOT)\n\t(absolute path)/src/subdir1/subsubdir1 (from $GOPATH)
46+
// cannot find package "subdir1/subsubdir1" in any of:\n\t(absolute path) (from $GOROOT)\n\t(absolute path) (from $GOPATH)
4547
r =
46-
"(cannot find package [^ ]* in any of:\\n\\t)/[^ ]*(/src/[^ ]* \\(from \\$GOROOT\\)\\n\\t)/[^ ]*(/src/[^ ]* \\(from \\$GOPATH\\))" and
48+
"(cannot find package [^ ]* in any of:\\n\\t).*( \\(from \\$GOROOT\\)\\n\\t).*( \\(from \\$GOPATH\\))" and
4749
if exists(msg.regexpCapture(r, 1))
4850
then
4951
result =

0 commit comments

Comments
 (0)