Skip to content

Commit

Permalink
*: use cockroachdb/errors instead of Go's own errors
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
knz committed May 7, 2020
1 parent d1a320e commit 8732022
Show file tree
Hide file tree
Showing 52 changed files with 62 additions and 54 deletions.
3 changes: 1 addition & 2 deletions pkg/base/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
package base

import (
"errors"

"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/util/uuid"
"github.com/cockroachdb/errors"
)

// CheckEnterpriseEnabled returns a non-nil error if the requested enterprise
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/importccl/import_into_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package importccl_test

import (
"context"
"errors"
"fmt"
"net/http"
"net/http/httptest"
Expand All @@ -28,6 +27,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/randutil"
"github.com/cockroachdb/errors"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/importccl/read_import_mysqlout.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ package importccl
import (
"bufio"
"context"
"errors"
"fmt"
"io"
"unicode"
Expand All @@ -22,6 +21,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/sqlbase"
"github.com/cockroachdb/cockroach/pkg/storage/cloud"
"github.com/cockroachdb/cockroach/pkg/util/ctxgroup"
"github.com/cockroachdb/errors"
)

type mysqloutfileReader struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/importccl/testutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package importccl

import (
"context"
"errors"
"fmt"
"io"
"math"
Expand All @@ -29,6 +28,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/storage/cloud"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/errors"
)

func descForTable(
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/workloadccl/roachmartccl/roachmart.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"bytes"
"context"
gosql "database/sql"
"errors"
"fmt"
"math/rand"
"strings"
Expand All @@ -21,6 +20,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/cockroach/pkg/workload"
"github.com/cockroachdb/cockroach/pkg/workload/histogram"
"github.com/cockroachdb/errors"
"github.com/spf13/pflag"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/debug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package cli

import (
"context"
"errors"
"fmt"
"path/filepath"
"regexp"
Expand All @@ -38,6 +37,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/errors"
)

func createStore(t *testing.T, path string) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/publish-provisional-artifacts/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"bufio"
"bytes"
"compress/gzip"
"errors"
"flag"
"fmt"
"go/build"
Expand All @@ -33,6 +32,7 @@ import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/cockroachdb/cockroach/pkg/util/version"
"github.com/cockroachdb/errors"
"github.com/kr/pretty"
)

Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/roachtest/gopg.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
"regexp"
"strconv"
"strings"

"github.com/cockroachdb/errors"
)

// Currently, we're running a version like 'v9.0.1'.
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/testfilter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ package main
import (
"bufio"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"os"
"strings"
"time"

"github.com/cockroachdb/errors"
)

const modeUsage = `strip:
Expand Down
2 changes: 1 addition & 1 deletion pkg/gossip/resolver/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ package resolver

import (
"context"
"errors"
"net"
"testing"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/errors"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/apply/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ package apply

import (
"context"
"errors"

"github.com/cockroachdb/errors"
"go.etcd.io/etcd/raft/raftpb"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_clear_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package batcheval

import (
"context"
"errors"

"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/result"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
"github.com/cockroachdb/cockroach/pkg/util"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
"github.com/kr/pretty"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/batcheval/cmd_clear_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package batcheval

import (
"context"
"errors"
"fmt"
"strings"
"testing"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/errors"
)

type wrappedBatch struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/client_lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package kvserver_test

import (
"context"
"errors"
"fmt"
"runtime"
"sync"
Expand All @@ -33,6 +32,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/errors"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/client_raft_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ package kvserver_test

import (
"context"
"errors"

"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
"github.com/cockroachdb/errors"
"go.etcd.io/etcd/raft"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/closedts/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package container

import (
"errors"
"sync/atomic"
"time"

Expand All @@ -24,6 +23,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/errors"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/closedts/container/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ package container

import (
"context"
"errors"

"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts/ctpb"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/errors"
)

type noopEverything struct{}
Expand Down
3 changes: 1 addition & 2 deletions pkg/kv/kvserver/closedts/provider/testutils/clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
package testutils

import (
"errors"

"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts/ctpb"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/errors"
)

// A TestClock provides a blocking LiveClockFn that can be triggered
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/closedts/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
package closedts

import (
"errors"
"time"

"github.com/cockroachdb/cockroach/pkg/settings"
"github.com/cockroachdb/errors"
)

// TargetDuration is the follower reads closed timestamp update target duration.
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/closedts/transport/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ package transport

import (
"context"
"errors"
"time"

"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts/ctpb"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/errors"
)

// Server handles incoming closed timestamp update stream requests.
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/debug_print.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package kvserver

import (
"bytes"
"errors"
"fmt"
"strconv"
"strings"
Expand All @@ -24,6 +23,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/protoutil"
"github.com/cockroachdb/errors"
"go.etcd.io/etcd/raft/raftpb"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/protectedts/protectedts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ package protectedts

import (
"context"
"errors"

"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/protectedts/ptpb"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/cockroach/pkg/util/uuid"
"github.com/cockroachdb/errors"
)

// ErrNotExists is returned from Get or Release if the record does
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/protectedts/ptstorage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ package ptstorage_test
import (
"bytes"
"context"
"errors"
"fmt"
"math"
"math/rand"
Expand Down Expand Up @@ -41,6 +40,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/protoutil"
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
"github.com/cockroachdb/cockroach/pkg/util/uuid"
"github.com/cockroachdb/errors"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/protectedts/ptverifier/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package ptverifier_test

import (
"context"
"errors"
"sync/atomic"
"testing"
"time"
Expand All @@ -30,6 +29,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/uuid"
"github.com/cockroachdb/errors"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/queue_concurrency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package kvserver

import (
"context"
"errors"
"math/rand"
"runtime"
"testing"
Expand All @@ -29,6 +28,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/metric"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/cockroach/pkg/util/tracing"
"github.com/cockroachdb/errors"
"golang.org/x/sync/errgroup"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/stores_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package kvserver

import (
"context"
"errors"
"reflect"
"testing"
"time"
Expand All @@ -28,6 +27,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/stop"
"github.com/cockroachdb/cockroach/pkg/util/tracing"
"github.com/cockroachdb/errors"
)

func newStores(ambientCtx log.AmbientContext, clock *hlc.Clock) *Stores {
Expand Down
Loading

0 comments on commit 8732022

Please sign in to comment.