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:
parent
22c1748628
commit
5b623d7046
1 changed files with 4 additions and 2 deletions
6
uri.go
6
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue