Skip to content

Commit 5b91296

Browse files
committed
remove github.com/pkg/errors in favor of stdlib
1 parent 48a86ac commit 5b91296

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

completion.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ package sqlds
33
import (
44
"context"
55
"encoding/json"
6+
"errors"
67
"fmt"
78
"net/http"
89

910
"github.com/grafana/grafana-plugin-sdk-go/backend"
10-
"github.com/pkg/errors"
1111
)
1212

13+
// ErrorNotImplemented is returned if the function is not implemented by the provided Driver (the Completable pointer is nil)
14+
var ErrorNotImplemented = errors.New("not implemented")
15+
1316
// Completable will be used to autocomplete Tables Schemas and Columns for SQL languages
1417
type Completable interface {
1518
Schemas(ctx context.Context) ([]string, error)
@@ -43,7 +46,7 @@ type columnRequest struct {
4346

4447
func (ds *sqldatasource) getSchemas(rw http.ResponseWriter, req *http.Request) {
4548
if ds.Completable == nil {
46-
handleError(rw, errors.New("not implemented"))
49+
handleError(rw, ErrorNotImplemented)
4750
return
4851
}
4952

@@ -58,7 +61,7 @@ func (ds *sqldatasource) getSchemas(rw http.ResponseWriter, req *http.Request) {
5861

5962
func (ds *sqldatasource) getTables(rw http.ResponseWriter, req *http.Request) {
6063
if ds.Completable == nil {
61-
handleError(rw, errors.New("not implemented"))
64+
handleError(rw, ErrorNotImplemented)
6265
return
6366
}
6467

@@ -78,7 +81,7 @@ func (ds *sqldatasource) getTables(rw http.ResponseWriter, req *http.Request) {
7881

7982
func (ds *sqldatasource) getColumns(rw http.ResponseWriter, req *http.Request) {
8083
if ds.Completable == nil {
81-
handleError(rw, errors.New("not implemented"))
84+
handleError(rw, ErrorNotImplemented)
8285
return
8386
}
8487

errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package sqlds
22

3-
import "github.com/pkg/errors"
3+
import "errors"
44

55
var (
6-
// ErrorBadDatasource ...
6+
// ErrorBadDatasource is returned if the data source could not be asserted to the correct type (this should basically never happen?)
77
ErrorBadDatasource = errors.New("type assertion to datasource failed")
88
// ErrorJSON is returned when json.Unmarshal fails
99
ErrorJSON = errors.New("error unmarshaling query JSON the Query Model")

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ go 1.15
44

55
require (
66
github.com/grafana/grafana-plugin-sdk-go v0.94.0
7-
github.com/pkg/errors v0.9.1
87
github.com/stretchr/testify v1.7.0
98
)

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0
251251
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
252252
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
253253
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
254-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
255254
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
256255
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
257256
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

macros.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package sqlds
22

33
import (
4+
"errors"
45
"fmt"
56
"regexp"
67
"strings"
7-
8-
"github.com/pkg/errors"
98
)
109

1110
var (

0 commit comments

Comments
 (0)