1
0
Fork 0
mirror of https://github.com/laravel-ls/uri synced 2026-07-05 00:43:41 +02:00

runtime.GOROOT() is deprectaed use os.LookupEnv()

This commit is contained in:
Henrik Hautakoski 2025-06-20 10:19:27 +02:00
parent 22c1748628
commit 5b623d7046

6
uri.go
View file

@ -8,8 +8,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/url" "net/url"
"os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"unicode" "unicode"
) )
@ -96,7 +96,9 @@ func New(input string) URI {
func File(path string) URI { func File(path string) URI {
const goRootPragma = "$GOROOT" const goRootPragma = "$GOROOT"
if len(path) >= len(goRootPragma) && strings.EqualFold(goRootPragma, path[:len(goRootPragma)]) { 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) { if !isWindowsDrivePath(path) {