From af2ccd199f575dc318768f3e0bfdec0719296b5d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Jul 2026 10:02:29 +0000 Subject: [PATCH] Move subst package into go/extractor/util --- go/extractor/BUILD.bazel | 1 - go/extractor/extractor.go | 3 +-- go/extractor/subst/BUILD.bazel | 18 ------------------ go/extractor/util/BUILD.bazel | 10 +++++++++- go/extractor/{subst => util}/subst.go | 2 +- go/extractor/{subst => util}/subst_other.go | 2 +- go/extractor/{subst => util}/subst_windows.go | 2 +- 7 files changed, 13 insertions(+), 25 deletions(-) delete mode 100644 go/extractor/subst/BUILD.bazel rename go/extractor/{subst => util}/subst.go (97%) rename go/extractor/{subst => util}/subst_other.go (90%) rename go/extractor/{subst => util}/subst_windows.go (98%) diff --git a/go/extractor/BUILD.bazel b/go/extractor/BUILD.bazel index c8e66c98d21..23158e25b15 100644 --- a/go/extractor/BUILD.bazel +++ b/go/extractor/BUILD.bazel @@ -19,7 +19,6 @@ go_library( "//go/extractor/dbscheme", "//go/extractor/diagnostics", "//go/extractor/srcarchive", - "//go/extractor/subst", "//go/extractor/toolchain", "//go/extractor/trap", "//go/extractor/util", diff --git a/go/extractor/extractor.go b/go/extractor/extractor.go index e3d134a522d..8310a97c56b 100644 --- a/go/extractor/extractor.go +++ b/go/extractor/extractor.go @@ -25,7 +25,6 @@ import ( "github.com/github/codeql-go/extractor/dbscheme" "github.com/github/codeql-go/extractor/diagnostics" "github.com/github/codeql-go/extractor/srcarchive" - "github.com/github/codeql-go/extractor/subst" "github.com/github/codeql-go/extractor/toolchain" "github.com/github/codeql-go/extractor/trap" "github.com/github/codeql-go/extractor/util" @@ -767,7 +766,7 @@ func normalizedPath(ast *ast.File, fset *token.FileSet) string { if err != nil { path = file } - return subst.ResolvePath(path) + return util.ResolvePath(path) } // extractFile extracts AST information for the given file diff --git a/go/extractor/subst/BUILD.bazel b/go/extractor/subst/BUILD.bazel deleted file mode 100644 index 280476992bb..00000000000 --- a/go/extractor/subst/BUILD.bazel +++ /dev/null @@ -1,18 +0,0 @@ -load("@rules_go//go:def.bzl", "go_library") - -go_library( - name = "subst", - srcs = [ - "subst.go", - "subst_other.go", - "subst_windows.go", - ], - importpath = "github.com/github/codeql-go/extractor/subst", - visibility = ["//go:__subpackages__"], - deps = select({ - "@rules_go//go/platform:windows": [ - "@org_golang_x_sys//windows", - ], - "//conditions:default": [], - }), -) diff --git a/go/extractor/util/BUILD.bazel b/go/extractor/util/BUILD.bazel index ccebf5ebd86..3123c1ac39d 100644 --- a/go/extractor/util/BUILD.bazel +++ b/go/extractor/util/BUILD.bazel @@ -9,11 +9,19 @@ go_library( "logging.go", "overlays.go", "semver.go", + "subst.go", + "subst_other.go", + "subst_windows.go", "util.go", ], importpath = "github.com/github/codeql-go/extractor/util", visibility = ["//visibility:public"], - deps = ["@org_golang_x_mod//semver"], + deps = ["@org_golang_x_mod//semver"] + select({ + "@rules_go//go/platform:windows": [ + "@org_golang_x_sys//windows", + ], + "//conditions:default": [], + }), ) go_test( diff --git a/go/extractor/subst/subst.go b/go/extractor/util/subst.go similarity index 97% rename from go/extractor/subst/subst.go rename to go/extractor/util/subst.go index 885f9f09a81..82dcffc495f 100644 --- a/go/extractor/subst/subst.go +++ b/go/extractor/util/subst.go @@ -1,4 +1,4 @@ -package subst +package util // ResolvePath resolves subst'd drive letters in a full path. // If the path starts with a subst'd drive letter, replaces it with the backing path. diff --git a/go/extractor/subst/subst_other.go b/go/extractor/util/subst_other.go similarity index 90% rename from go/extractor/subst/subst_other.go rename to go/extractor/util/subst_other.go index 8e153bf3bd6..f1789afdaa7 100644 --- a/go/extractor/subst/subst_other.go +++ b/go/extractor/util/subst_other.go @@ -1,6 +1,6 @@ //go:build !windows -package subst +package util // ResolveDrive is a no-op on non-Windows platforms. func ResolveDrive(driveRoot string) string { return "" } diff --git a/go/extractor/subst/subst_windows.go b/go/extractor/util/subst_windows.go similarity index 98% rename from go/extractor/subst/subst_windows.go rename to go/extractor/util/subst_windows.go index 58318eb8fea..a5bf2d7380f 100644 --- a/go/extractor/subst/subst_windows.go +++ b/go/extractor/util/subst_windows.go @@ -1,6 +1,6 @@ //go:build windows -package subst +package util import ( "os"