1
0
Fork 0
mirror of https://github.com/laravel-ls/uri synced 2026-06-16 01:54:57 +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"
"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) {