mirror of
https://github.com/laravel-ls/uri
synced 2026-06-16 01:54:57 +02:00
module: remove x/xerrors dependency
This commit is contained in:
parent
016c8743e5
commit
63eaac75cc
2 changed files with 6 additions and 10 deletions
5
go.mod
5
go.mod
|
|
@ -2,7 +2,4 @@ module go.lsp.dev/uri
|
|||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/google/go-cmp v0.4.0
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||
)
|
||||
require github.com/google/go-cmp v0.4.0
|
||||
|
|
|
|||
11
uri.go
11
uri.go
|
|
@ -5,14 +5,13 @@
|
|||
package uri
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -59,11 +58,11 @@ func (u URI) Filename() string {
|
|||
func filename(uri URI) (string, error) {
|
||||
u, err := url.ParseRequestURI(string(uri))
|
||||
if err != nil {
|
||||
return "", xerrors.Errorf("failed to parse request URI: %w", err)
|
||||
return "", fmt.Errorf("failed to parse request URI: %w", err)
|
||||
}
|
||||
|
||||
if u.Scheme != FileScheme {
|
||||
return "", xerrors.Errorf("only file URIs are supported, got %v", u.Scheme)
|
||||
return "", fmt.Errorf("only file URIs are supported, got %v", u.Scheme)
|
||||
}
|
||||
|
||||
if isWindowsDriveURI(u.Path) {
|
||||
|
|
@ -116,7 +115,7 @@ func File(path string) URI {
|
|||
func Parse(s string) (u URI, err error) {
|
||||
us, err := url.Parse(s)
|
||||
if err != nil {
|
||||
return u, xerrors.Errorf("url.Parse: %w\n", err)
|
||||
return u, fmt.Errorf("url.Parse: %w", err)
|
||||
}
|
||||
|
||||
switch us.Scheme {
|
||||
|
|
@ -139,7 +138,7 @@ func Parse(s string) (u URI, err error) {
|
|||
u = URI(ut.String())
|
||||
|
||||
default:
|
||||
return u, xerrors.New("unknown scheme")
|
||||
return u, errors.New("unknown scheme")
|
||||
}
|
||||
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue