Move subst package into go/extractor/util

This commit is contained in:
copilot-swe-agent[bot]
2026-07-07 10:02:29 +00:00
committed by GitHub
parent 1870a01df5
commit af2ccd199f
7 changed files with 13 additions and 25 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -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": [],
}),
)

View File

@@ -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(

View File

@@ -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.

View File

@@ -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 "" }

View File

@@ -1,6 +1,6 @@
//go:build windows
package subst
package util
import (
"os"