From 5b623d7046d8602be8525bafcce478459e952535 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 20 Jun 2025 10:19:27 +0200 Subject: [PATCH] runtime.GOROOT() is deprectaed use os.LookupEnv() --- uri.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/uri.go b/uri.go index 8513344..df12b10 100644 --- a/uri.go +++ b/uri.go @@ -8,8 +8,8 @@ import ( "errors" "fmt" "net/url" + "os" "path/filepath" - "runtime" "strings" "unicode" ) @@ -96,7 +96,9 @@ func New(input string) URI { func File(path string) URI { const goRootPragma = "$GOROOT" if len(path) >= len(goRootPragma) && strings.EqualFold(goRootPragma, path[:len(goRootPragma)]) { - path = runtime.GOROOT() + path[len(goRootPragma):] + if goRoot, found := os.LookupEnv("GOROOT"); found { + path = goRoot + path[len(goRootPragma):] + } } if !isWindowsDrivePath(path) {