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:
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"
|
"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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue