Skip to content

Commit 63eaac7

Browse files
committed
module: remove x/xerrors dependency
1 parent 016c874 commit 63eaac7

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ module go.lsp.dev/uri
22

33
go 1.13
44

5-
require (
6-
github.com/google/go-cmp v0.4.0
7-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
8-
)
5+
require github.com/google/go-cmp v0.4.0

uri.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
package uri
66

77
import (
8+
"errors"
89
"fmt"
910
"net/url"
1011
"path/filepath"
1112
"runtime"
1213
"strings"
1314
"unicode"
14-
15-
"golang.org/x/xerrors"
1615
)
1716

1817
const (
@@ -59,11 +58,11 @@ func (u URI) Filename() string {
5958
func filename(uri URI) (string, error) {
6059
u, err := url.ParseRequestURI(string(uri))
6160
if err != nil {
62-
return "", xerrors.Errorf("failed to parse request URI: %w", err)
61+
return "", fmt.Errorf("failed to parse request URI: %w", err)
6362
}
6463

6564
if u.Scheme != FileScheme {
66-
return "", xerrors.Errorf("only file URIs are supported, got %v", u.Scheme)
65+
return "", fmt.Errorf("only file URIs are supported, got %v", u.Scheme)
6766
}
6867

6968
if isWindowsDriveURI(u.Path) {
@@ -116,7 +115,7 @@ func File(path string) URI {
116115
func Parse(s string) (u URI, err error) {
117116
us, err := url.Parse(s)
118117
if err != nil {
119-
return u, xerrors.Errorf("url.Parse: %w\n", err)
118+
return u, fmt.Errorf("url.Parse: %w", err)
120119
}
121120

122121
switch us.Scheme {
@@ -139,7 +138,7 @@ func Parse(s string) (u URI, err error) {
139138
u = URI(ut.String())
140139

141140
default:
142-
return u, xerrors.New("unknown scheme")
141+
return u, errors.New("unknown scheme")
143142
}
144143

145144
return

0 commit comments

Comments
 (0)