From 87320220927c887cd4ac6677259e6c5d80569b83 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Fri, 1 May 2020 14:41:26 +0200 Subject: [PATCH] *: use cockroachdb/errors instead of Go's own errors Release note: None --- pkg/base/license.go | 3 +-- pkg/ccl/importccl/import_into_test.go | 2 +- pkg/ccl/importccl/read_import_mysqlout.go | 2 +- pkg/ccl/importccl/testutils_test.go | 2 +- pkg/ccl/workloadccl/roachmartccl/roachmart.go | 2 +- pkg/cli/debug_test.go | 2 +- pkg/cmd/publish-provisional-artifacts/main.go | 2 +- pkg/cmd/roachtest/gopg.go | 3 ++- pkg/cmd/testfilter/main.go | 3 ++- pkg/gossip/resolver/resolver_test.go | 2 +- pkg/kv/kvserver/apply/task.go | 2 +- pkg/kv/kvserver/batcheval/cmd_clear_range.go | 2 +- pkg/kv/kvserver/batcheval/cmd_clear_range_test.go | 2 +- pkg/kv/kvserver/client_lease_test.go | 2 +- pkg/kv/kvserver/client_raft_helpers_test.go | 2 +- pkg/kv/kvserver/closedts/container/container.go | 2 +- pkg/kv/kvserver/closedts/container/noop.go | 2 +- pkg/kv/kvserver/closedts/provider/testutils/clock.go | 3 +-- pkg/kv/kvserver/closedts/setting.go | 2 +- pkg/kv/kvserver/closedts/transport/server.go | 2 +- pkg/kv/kvserver/debug_print.go | 2 +- pkg/kv/kvserver/protectedts/protectedts.go | 2 +- pkg/kv/kvserver/protectedts/ptstorage/storage_test.go | 2 +- pkg/kv/kvserver/protectedts/ptverifier/verifier_test.go | 2 +- pkg/kv/kvserver/queue_concurrency_test.go | 2 +- pkg/kv/kvserver/stores_test.go | 2 +- pkg/security/certificate_loader_test.go | 2 +- pkg/server/status/runtime.go | 5 +++-- pkg/sql/colflow/colrpc/colrpc_test.go | 2 +- pkg/sql/colflow/colrpc/inbox_test.go | 2 +- pkg/sql/conn_executor_savepoints.go | 2 +- pkg/sql/opt/optgen/cmd/langgen/main.go | 2 +- pkg/sql/opt/optgen/cmd/optgen/main.go | 2 +- pkg/sql/opt/optgen/cmd/optgen/main_test.go | 2 +- pkg/sql/opt/optgen/lang/compiler.go | 3 ++- pkg/sql/opt/optgen/lang/compiler_test.go | 2 +- pkg/sql/roleoption/role_option.go | 2 +- pkg/sql/rowexec/joinreader_test.go | 2 +- pkg/sql/rowexec/mergejoiner.go | 2 +- pkg/testutils/lint/lint_test.go | 1 + pkg/testutils/reduce/reduce.go | 2 +- pkg/util/encoding/csv/writer_test.go | 3 ++- pkg/util/grpcutil/log_test.go | 2 +- pkg/util/interval/btree_based_interval.go | 2 +- pkg/util/interval/interval.go | 2 +- pkg/util/interval/range_group_test.go | 2 +- pkg/util/log/vmodule.go | 2 +- pkg/util/sdnotify/sdnotify_windows.go | 3 ++- pkg/util/stop/stopper.go | 2 +- pkg/util/syncutil/singleflight/singleflight_test.go | 3 ++- pkg/util/sysutil/sysutil_windows.go | 3 ++- pkg/util/timeutil/zoneinfo.go | 3 ++- 52 files changed, 62 insertions(+), 54 deletions(-) diff --git a/pkg/base/license.go b/pkg/base/license.go index 0f7941f48322..98148ca10587 100644 --- a/pkg/base/license.go +++ b/pkg/base/license.go @@ -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 diff --git a/pkg/ccl/importccl/import_into_test.go b/pkg/ccl/importccl/import_into_test.go index 89f0cf69bb38..9313cb7107a6 100644 --- a/pkg/ccl/importccl/import_into_test.go +++ b/pkg/ccl/importccl/import_into_test.go @@ -10,7 +10,6 @@ package importccl_test import ( "context" - "errors" "fmt" "net/http" "net/http/httptest" @@ -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" ) diff --git a/pkg/ccl/importccl/read_import_mysqlout.go b/pkg/ccl/importccl/read_import_mysqlout.go index 95e3bcf0f426..c0e13cfde209 100644 --- a/pkg/ccl/importccl/read_import_mysqlout.go +++ b/pkg/ccl/importccl/read_import_mysqlout.go @@ -11,7 +11,6 @@ package importccl import ( "bufio" "context" - "errors" "fmt" "io" "unicode" @@ -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 { diff --git a/pkg/ccl/importccl/testutils_test.go b/pkg/ccl/importccl/testutils_test.go index 1cad3ae613da..24c76f109fcf 100644 --- a/pkg/ccl/importccl/testutils_test.go +++ b/pkg/ccl/importccl/testutils_test.go @@ -10,7 +10,6 @@ package importccl import ( "context" - "errors" "fmt" "io" "math" @@ -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( diff --git a/pkg/ccl/workloadccl/roachmartccl/roachmart.go b/pkg/ccl/workloadccl/roachmartccl/roachmart.go index b602d5890158..b158243d202d 100644 --- a/pkg/ccl/workloadccl/roachmartccl/roachmart.go +++ b/pkg/ccl/workloadccl/roachmartccl/roachmart.go @@ -12,7 +12,6 @@ import ( "bytes" "context" gosql "database/sql" - "errors" "fmt" "math/rand" "strings" @@ -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" ) diff --git a/pkg/cli/debug_test.go b/pkg/cli/debug_test.go index a3d89ca96c3f..d806f827bd0c 100644 --- a/pkg/cli/debug_test.go +++ b/pkg/cli/debug_test.go @@ -12,7 +12,6 @@ package cli import ( "context" - "errors" "fmt" "path/filepath" "regexp" @@ -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) { diff --git a/pkg/cmd/publish-provisional-artifacts/main.go b/pkg/cmd/publish-provisional-artifacts/main.go index 9e75b669c7b7..ecef569ddf11 100644 --- a/pkg/cmd/publish-provisional-artifacts/main.go +++ b/pkg/cmd/publish-provisional-artifacts/main.go @@ -16,7 +16,6 @@ import ( "bufio" "bytes" "compress/gzip" - "errors" "flag" "fmt" "go/build" @@ -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" ) diff --git a/pkg/cmd/roachtest/gopg.go b/pkg/cmd/roachtest/gopg.go index 50ff74304821..a2ab7c975bdf 100644 --- a/pkg/cmd/roachtest/gopg.go +++ b/pkg/cmd/roachtest/gopg.go @@ -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'. diff --git a/pkg/cmd/testfilter/main.go b/pkg/cmd/testfilter/main.go index 962aac3c50fb..75624208a8a8 100644 --- a/pkg/cmd/testfilter/main.go +++ b/pkg/cmd/testfilter/main.go @@ -33,13 +33,14 @@ package main import ( "bufio" "encoding/json" - "errors" "flag" "fmt" "io" "os" "strings" "time" + + "github.com/cockroachdb/errors" ) const modeUsage = `strip: diff --git a/pkg/gossip/resolver/resolver_test.go b/pkg/gossip/resolver/resolver_test.go index 42d0adbb9d75..f8eb30ee614a 100644 --- a/pkg/gossip/resolver/resolver_test.go +++ b/pkg/gossip/resolver/resolver_test.go @@ -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" ) diff --git a/pkg/kv/kvserver/apply/task.go b/pkg/kv/kvserver/apply/task.go index 4bcf9d1ba798..456c59e907f6 100644 --- a/pkg/kv/kvserver/apply/task.go +++ b/pkg/kv/kvserver/apply/task.go @@ -12,8 +12,8 @@ package apply import ( "context" - "errors" + "github.com/cockroachdb/errors" "go.etcd.io/etcd/raft/raftpb" ) diff --git a/pkg/kv/kvserver/batcheval/cmd_clear_range.go b/pkg/kv/kvserver/batcheval/cmd_clear_range.go index d214714bd780..4b27561308b2 100644 --- a/pkg/kv/kvserver/batcheval/cmd_clear_range.go +++ b/pkg/kv/kvserver/batcheval/cmd_clear_range.go @@ -12,7 +12,6 @@ package batcheval import ( "context" - "errors" "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/result" @@ -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" ) diff --git a/pkg/kv/kvserver/batcheval/cmd_clear_range_test.go b/pkg/kv/kvserver/batcheval/cmd_clear_range_test.go index e93a8eb6b63d..ec4e17bdcc99 100644 --- a/pkg/kv/kvserver/batcheval/cmd_clear_range_test.go +++ b/pkg/kv/kvserver/batcheval/cmd_clear_range_test.go @@ -12,7 +12,6 @@ package batcheval import ( "context" - "errors" "fmt" "strings" "testing" @@ -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 { diff --git a/pkg/kv/kvserver/client_lease_test.go b/pkg/kv/kvserver/client_lease_test.go index 26149968b2c2..66065d098d63 100644 --- a/pkg/kv/kvserver/client_lease_test.go +++ b/pkg/kv/kvserver/client_lease_test.go @@ -12,7 +12,6 @@ package kvserver_test import ( "context" - "errors" "fmt" "runtime" "sync" @@ -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" ) diff --git a/pkg/kv/kvserver/client_raft_helpers_test.go b/pkg/kv/kvserver/client_raft_helpers_test.go index a40f501acfba..d500cbbd9c39 100644 --- a/pkg/kv/kvserver/client_raft_helpers_test.go +++ b/pkg/kv/kvserver/client_raft_helpers_test.go @@ -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" ) diff --git a/pkg/kv/kvserver/closedts/container/container.go b/pkg/kv/kvserver/closedts/container/container.go index bc97b0b94831..e26c8ed27c33 100644 --- a/pkg/kv/kvserver/closedts/container/container.go +++ b/pkg/kv/kvserver/closedts/container/container.go @@ -11,7 +11,6 @@ package container import ( - "errors" "sync/atomic" "time" @@ -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" ) diff --git a/pkg/kv/kvserver/closedts/container/noop.go b/pkg/kv/kvserver/closedts/container/noop.go index 5cb538184a06..2541c62e373b 100644 --- a/pkg/kv/kvserver/closedts/container/noop.go +++ b/pkg/kv/kvserver/closedts/container/noop.go @@ -12,7 +12,6 @@ package container import ( "context" - "errors" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts/ctpb" @@ -20,6 +19,7 @@ import ( "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{} diff --git a/pkg/kv/kvserver/closedts/provider/testutils/clock.go b/pkg/kv/kvserver/closedts/provider/testutils/clock.go index 84d3f3bc02b9..21176fdadb05 100644 --- a/pkg/kv/kvserver/closedts/provider/testutils/clock.go +++ b/pkg/kv/kvserver/closedts/provider/testutils/clock.go @@ -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 diff --git a/pkg/kv/kvserver/closedts/setting.go b/pkg/kv/kvserver/closedts/setting.go index 03240e24e396..2c7428aa6ddb 100644 --- a/pkg/kv/kvserver/closedts/setting.go +++ b/pkg/kv/kvserver/closedts/setting.go @@ -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. diff --git a/pkg/kv/kvserver/closedts/transport/server.go b/pkg/kv/kvserver/closedts/transport/server.go index 5a942d26d6a9..0c29cac2d609 100644 --- a/pkg/kv/kvserver/closedts/transport/server.go +++ b/pkg/kv/kvserver/closedts/transport/server.go @@ -12,7 +12,6 @@ package transport import ( "context" - "errors" "time" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts" @@ -20,6 +19,7 @@ import ( "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. diff --git a/pkg/kv/kvserver/debug_print.go b/pkg/kv/kvserver/debug_print.go index 7f9a4567990f..955b586195c3 100644 --- a/pkg/kv/kvserver/debug_print.go +++ b/pkg/kv/kvserver/debug_print.go @@ -12,7 +12,6 @@ package kvserver import ( "bytes" - "errors" "fmt" "strconv" "strings" @@ -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" ) diff --git a/pkg/kv/kvserver/protectedts/protectedts.go b/pkg/kv/kvserver/protectedts/protectedts.go index 134d2d1a3c32..ed7ce1eea4c8 100644 --- a/pkg/kv/kvserver/protectedts/protectedts.go +++ b/pkg/kv/kvserver/protectedts/protectedts.go @@ -14,7 +14,6 @@ package protectedts import ( "context" - "errors" "github.com/cockroachdb/cockroach/pkg/kv" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/protectedts/ptpb" @@ -22,6 +21,7 @@ import ( "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 diff --git a/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go b/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go index 31e866ca0178..795824d31b70 100644 --- a/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go +++ b/pkg/kv/kvserver/protectedts/ptstorage/storage_test.go @@ -13,7 +13,6 @@ package ptstorage_test import ( "bytes" "context" - "errors" "fmt" "math" "math/rand" @@ -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" ) diff --git a/pkg/kv/kvserver/protectedts/ptverifier/verifier_test.go b/pkg/kv/kvserver/protectedts/ptverifier/verifier_test.go index 79b8cbdef91f..5325c2fce125 100644 --- a/pkg/kv/kvserver/protectedts/ptverifier/verifier_test.go +++ b/pkg/kv/kvserver/protectedts/ptverifier/verifier_test.go @@ -12,7 +12,6 @@ package ptverifier_test import ( "context" - "errors" "sync/atomic" "testing" "time" @@ -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" ) diff --git a/pkg/kv/kvserver/queue_concurrency_test.go b/pkg/kv/kvserver/queue_concurrency_test.go index 13e123aec081..e1d95c1b20d2 100644 --- a/pkg/kv/kvserver/queue_concurrency_test.go +++ b/pkg/kv/kvserver/queue_concurrency_test.go @@ -12,7 +12,6 @@ package kvserver import ( "context" - "errors" "math/rand" "runtime" "testing" @@ -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" ) diff --git a/pkg/kv/kvserver/stores_test.go b/pkg/kv/kvserver/stores_test.go index 0eea4126b16e..ed18d7d80703 100644 --- a/pkg/kv/kvserver/stores_test.go +++ b/pkg/kv/kvserver/stores_test.go @@ -12,7 +12,6 @@ package kvserver import ( "context" - "errors" "reflect" "testing" "time" @@ -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 { diff --git a/pkg/security/certificate_loader_test.go b/pkg/security/certificate_loader_test.go index 06eacd27892d..f2026330a06a 100644 --- a/pkg/security/certificate_loader_test.go +++ b/pkg/security/certificate_loader_test.go @@ -17,7 +17,6 @@ import ( "crypto/x509" "crypto/x509/pkix" "encoding/pem" - "errors" "io/ioutil" "math/big" "os" @@ -31,6 +30,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/util/leaktest" "github.com/cockroachdb/cockroach/pkg/util/timeutil" + "github.com/cockroachdb/errors" ) func TestCertNomenclature(t *testing.T) { diff --git a/pkg/server/status/runtime.go b/pkg/server/status/runtime.go index 26f41ab3eab9..9c45567f6593 100644 --- a/pkg/server/status/runtime.go +++ b/pkg/server/status/runtime.go @@ -12,6 +12,7 @@ package status import ( "context" + "fmt" "os" "runtime" "runtime/debug" @@ -495,7 +496,7 @@ func (rsr *RuntimeStatSampler) SampleEnvironment(ctx context.Context, ms GoMemSt staleMsg = "(stale)" } goTotal := ms.Sys - ms.HeapReleased - log.Infof(ctx, "runtime stats: %s RSS, %d goroutines, %s/%s/%s GO alloc/idle/total%s, "+ + log.Infof(ctx, "%s", log.Safe(fmt.Sprintf("runtime stats: %s RSS, %d goroutines, %s/%s/%s GO alloc/idle/total%s, "+ "%s/%s CGO alloc/total, %.1f CGO/sec, %.1f/%.1f %%(u/s)time, %.1f %%gc (%dx), "+ "%s/%s (r/w)net", humanize.IBytes(mem.Resident), numGoroutine, @@ -504,7 +505,7 @@ func (rsr *RuntimeStatSampler) SampleEnvironment(ctx context.Context, ms GoMemSt humanize.IBytes(uint64(cgoAllocated)), humanize.IBytes(uint64(cgoTotal)), cgoRate, 100*uPerc, 100*sPerc, 100*gcPausePercent, gc.NumGC-rsr.last.gcCount, humanize.IBytes(deltaNet.BytesRecv), humanize.IBytes(deltaNet.BytesSent), - ) + ))) rsr.last.cgoCall = numCgoCall rsr.last.gcCount = gc.NumGC diff --git a/pkg/sql/colflow/colrpc/colrpc_test.go b/pkg/sql/colflow/colrpc/colrpc_test.go index c61116ece750..0196e5591def 100644 --- a/pkg/sql/colflow/colrpc/colrpc_test.go +++ b/pkg/sql/colflow/colrpc/colrpc_test.go @@ -12,7 +12,6 @@ package colrpc import ( "context" - "errors" "fmt" "io" "math" @@ -37,6 +36,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/randutil" "github.com/cockroachdb/cockroach/pkg/util/stop" "github.com/cockroachdb/cockroach/pkg/util/uuid" + "github.com/cockroachdb/errors" "github.com/cockroachdb/logtags" "github.com/stretchr/testify/require" "google.golang.org/grpc" diff --git a/pkg/sql/colflow/colrpc/inbox_test.go b/pkg/sql/colflow/colrpc/inbox_test.go index 3d0e5e9948ed..bc02f721d793 100644 --- a/pkg/sql/colflow/colrpc/inbox_test.go +++ b/pkg/sql/colflow/colrpc/inbox_test.go @@ -13,7 +13,6 @@ package colrpc import ( "bytes" "context" - "errors" "fmt" "io" "sync" @@ -31,6 +30,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/util/leaktest" "github.com/cockroachdb/cockroach/pkg/util/randutil" + "github.com/cockroachdb/errors" "github.com/stretchr/testify/require" ) diff --git a/pkg/sql/conn_executor_savepoints.go b/pkg/sql/conn_executor_savepoints.go index e5c4887a8847..10a9cadaf1f5 100644 --- a/pkg/sql/conn_executor_savepoints.go +++ b/pkg/sql/conn_executor_savepoints.go @@ -12,7 +12,6 @@ package sql import ( "context" - "errors" "strings" "github.com/cockroachdb/cockroach/pkg/clusterversion" @@ -26,6 +25,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented" "github.com/cockroachdb/cockroach/pkg/util/fsm" "github.com/cockroachdb/cockroach/pkg/util/hlc" + "github.com/cockroachdb/errors" ) // commitOnReleaseSavepointName is the name of the savepoint with special diff --git a/pkg/sql/opt/optgen/cmd/langgen/main.go b/pkg/sql/opt/optgen/cmd/langgen/main.go index 81584296087e..8993d8eff825 100644 --- a/pkg/sql/opt/optgen/cmd/langgen/main.go +++ b/pkg/sql/opt/optgen/cmd/langgen/main.go @@ -12,7 +12,6 @@ package main import ( "bytes" - "errors" "flag" "fmt" "go/format" @@ -20,6 +19,7 @@ import ( "os" "github.com/cockroachdb/cockroach/pkg/sql/opt/optgen/lang" + "github.com/cockroachdb/errors" ) type genFunc func(compiled *lang.CompiledExpr, w io.Writer) diff --git a/pkg/sql/opt/optgen/cmd/optgen/main.go b/pkg/sql/opt/optgen/cmd/optgen/main.go index 555f4bc150ee..2b82e54b3697 100644 --- a/pkg/sql/opt/optgen/cmd/optgen/main.go +++ b/pkg/sql/opt/optgen/cmd/optgen/main.go @@ -12,7 +12,6 @@ package main import ( "bytes" - "errors" "flag" "fmt" "go/format" @@ -22,6 +21,7 @@ import ( "sort" "github.com/cockroachdb/cockroach/pkg/sql/opt/optgen/lang" + "github.com/cockroachdb/errors" ) type globResolver func(pattern string) (matches []string, err error) diff --git a/pkg/sql/opt/optgen/cmd/optgen/main_test.go b/pkg/sql/opt/optgen/cmd/optgen/main_test.go index 18ea0c3445b8..943a6b2135c5 100644 --- a/pkg/sql/opt/optgen/cmd/optgen/main_test.go +++ b/pkg/sql/opt/optgen/cmd/optgen/main_test.go @@ -12,7 +12,6 @@ package main import ( "bytes" - "errors" "flag" "io" "path/filepath" @@ -20,6 +19,7 @@ import ( "testing" "github.com/cockroachdb/datadriven" + "github.com/cockroachdb/errors" ) var ( diff --git a/pkg/sql/opt/optgen/lang/compiler.go b/pkg/sql/opt/optgen/lang/compiler.go index cc9017cec8f9..40e804e618d6 100644 --- a/pkg/sql/opt/optgen/lang/compiler.go +++ b/pkg/sql/opt/optgen/lang/compiler.go @@ -12,8 +12,9 @@ package lang import ( "bytes" - "errors" "fmt" + + "github.com/cockroachdb/errors" ) // CompiledExpr is the result of Optgen scanning, parsing, and semantic diff --git a/pkg/sql/opt/optgen/lang/compiler_test.go b/pkg/sql/opt/optgen/lang/compiler_test.go index 06cc238ecf72..68de97c85bb8 100644 --- a/pkg/sql/opt/optgen/lang/compiler_test.go +++ b/pkg/sql/opt/optgen/lang/compiler_test.go @@ -11,13 +11,13 @@ package lang import ( - "errors" "fmt" "io" "strings" "testing" "github.com/cockroachdb/datadriven" + "github.com/cockroachdb/errors" ) func TestCompiler(t *testing.T) { diff --git a/pkg/sql/roleoption/role_option.go b/pkg/sql/roleoption/role_option.go index 61e0bb85d743..82402d8a6082 100644 --- a/pkg/sql/roleoption/role_option.go +++ b/pkg/sql/roleoption/role_option.go @@ -11,13 +11,13 @@ package roleoption import ( - "errors" "strings" "github.com/cockroachdb/cockroach/pkg/security" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode" "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror" "github.com/cockroachdb/cockroach/pkg/sql/sqltelemetry" + "github.com/cockroachdb/errors" ) //go:generate stringer -type=Option diff --git a/pkg/sql/rowexec/joinreader_test.go b/pkg/sql/rowexec/joinreader_test.go index 93f584cf1962..b751085856b1 100644 --- a/pkg/sql/rowexec/joinreader_test.go +++ b/pkg/sql/rowexec/joinreader_test.go @@ -15,7 +15,6 @@ package rowexec import ( "context" - "errors" "fmt" "math" "strings" @@ -39,6 +38,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/mon" "github.com/cockroachdb/cockroach/pkg/util/tracing" + "github.com/cockroachdb/errors" "github.com/stretchr/testify/require" ) diff --git a/pkg/sql/rowexec/mergejoiner.go b/pkg/sql/rowexec/mergejoiner.go index 98bd4dc14976..d5e8f63d313d 100644 --- a/pkg/sql/rowexec/mergejoiner.go +++ b/pkg/sql/rowexec/mergejoiner.go @@ -12,7 +12,6 @@ package rowexec import ( "context" - "errors" "fmt" "github.com/cockroachdb/cockroach/pkg/sql/execinfra" @@ -21,6 +20,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util" "github.com/cockroachdb/cockroach/pkg/util/humanizeutil" "github.com/cockroachdb/cockroach/pkg/util/tracing" + "github.com/cockroachdb/errors" "github.com/opentracing/opentracing-go" ) diff --git a/pkg/testutils/lint/lint_test.go b/pkg/testutils/lint/lint_test.go index 1ca500a2b7a9..98b0317f95f0 100644 --- a/pkg/testutils/lint/lint_test.go +++ b/pkg/testutils/lint/lint_test.go @@ -1188,6 +1188,7 @@ func TestLint(t *testing.T) { "github.com/satori/go.uuid": "util/uuid", "golang.org/x/sync/singleflight": "github.com/cockroachdb/cockroach/pkg/util/syncutil/singleflight", "syscall": "sysutil", + "errors": "github.com/cockroachdb/errors", "github.com/cockroachdb/errors/assert": "github.com/cockroachdb/errors", "github.com/cockroachdb/errors/barriers": "github.com/cockroachdb/errors", "github.com/cockroachdb/errors/contexttags": "github.com/cockroachdb/errors", diff --git a/pkg/testutils/reduce/reduce.go b/pkg/testutils/reduce/reduce.go index 7cd667ee13cc..5a327d76ae32 100644 --- a/pkg/testutils/reduce/reduce.go +++ b/pkg/testutils/reduce/reduce.go @@ -16,13 +16,13 @@ package reduce import ( "context" - "errors" "fmt" "io" "runtime" "github.com/cockroachdb/cockroach/pkg/util/ctxgroup" "github.com/cockroachdb/cockroach/pkg/util/timeutil" + "github.com/cockroachdb/errors" ) // Pass defines a reduce pass. diff --git a/pkg/util/encoding/csv/writer_test.go b/pkg/util/encoding/csv/writer_test.go index 5917d2f1660b..d57a7f3d15d8 100644 --- a/pkg/util/encoding/csv/writer_test.go +++ b/pkg/util/encoding/csv/writer_test.go @@ -16,8 +16,9 @@ package csv import ( "bytes" - "errors" "testing" + + "github.com/cockroachdb/errors" ) var writeTests = []struct { diff --git a/pkg/util/grpcutil/log_test.go b/pkg/util/grpcutil/log_test.go index 772c42fbac78..0dfab6a10fa4 100644 --- a/pkg/util/grpcutil/log_test.go +++ b/pkg/util/grpcutil/log_test.go @@ -11,13 +11,13 @@ package grpcutil import ( - "errors" "regexp" "testing" "time" "github.com/cockroachdb/cockroach/pkg/testutils" "github.com/cockroachdb/cockroach/pkg/util/timeutil" + "github.com/cockroachdb/errors" "github.com/petermattis/goid" ) diff --git a/pkg/util/interval/btree_based_interval.go b/pkg/util/interval/btree_based_interval.go index d0e2c7ed4422..77a883f000c8 100644 --- a/pkg/util/interval/btree_based_interval.go +++ b/pkg/util/interval/btree_based_interval.go @@ -13,11 +13,11 @@ package interval import ( - "errors" "sort" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/syncutil" + "github.com/cockroachdb/errors" ) const ( diff --git a/pkg/util/interval/interval.go b/pkg/util/interval/interval.go index d5e280fc9a3c..86a896ed5f9c 100644 --- a/pkg/util/interval/interval.go +++ b/pkg/util/interval/interval.go @@ -24,11 +24,11 @@ package interval import ( "bytes" - "errors" "fmt" "github.com/cockroachdb/cockroach/pkg/util/envutil" "github.com/cockroachdb/cockroach/pkg/util/log" + "github.com/cockroachdb/errors" ) // ErrInvertedRange is returned if an interval is used where the start value is greater diff --git a/pkg/util/interval/range_group_test.go b/pkg/util/interval/range_group_test.go index 30bb43a4580a..fe9cb621858f 100644 --- a/pkg/util/interval/range_group_test.go +++ b/pkg/util/interval/range_group_test.go @@ -13,11 +13,11 @@ package interval import ( "bytes" "crypto/rand" - "errors" "reflect" "testing" _ "github.com/cockroachdb/cockroach/pkg/util/log" // for flags + "github.com/cockroachdb/errors" ) func forEachRangeGroupImpl(t *testing.T, fn func(t *testing.T, rg RangeGroup)) { diff --git a/pkg/util/log/vmodule.go b/pkg/util/log/vmodule.go index e083c66b0410..7ece5860d867 100644 --- a/pkg/util/log/vmodule.go +++ b/pkg/util/log/vmodule.go @@ -12,7 +12,6 @@ package log import ( "bytes" - "errors" "fmt" "path/filepath" "runtime" @@ -22,6 +21,7 @@ import ( "sync/atomic" "github.com/cockroachdb/cockroach/pkg/util/syncutil" + "github.com/cockroachdb/errors" ) type vmoduleConfig struct { diff --git a/pkg/util/sdnotify/sdnotify_windows.go b/pkg/util/sdnotify/sdnotify_windows.go index 68246957cf1f..54c764e33a26 100644 --- a/pkg/util/sdnotify/sdnotify_windows.go +++ b/pkg/util/sdnotify/sdnotify_windows.go @@ -11,8 +11,9 @@ package sdnotify import ( - "errors" "os/exec" + + "github.com/cockroachdb/errors" ) func ready() error { diff --git a/pkg/util/stop/stopper.go b/pkg/util/stop/stopper.go index 221e48d5aaed..c6f587f33d8d 100644 --- a/pkg/util/stop/stopper.go +++ b/pkg/util/stop/stopper.go @@ -12,7 +12,6 @@ package stop import ( "context" - "errors" "fmt" "net/http" "sort" @@ -27,6 +26,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/quotapool" "github.com/cockroachdb/cockroach/pkg/util/syncutil" "github.com/cockroachdb/cockroach/pkg/util/tracing" + "github.com/cockroachdb/errors" opentracing "github.com/opentracing/opentracing-go" ) diff --git a/pkg/util/syncutil/singleflight/singleflight_test.go b/pkg/util/syncutil/singleflight/singleflight_test.go index 0c2dbac0f4da..90af13a6eb26 100644 --- a/pkg/util/syncutil/singleflight/singleflight_test.go +++ b/pkg/util/syncutil/singleflight/singleflight_test.go @@ -17,12 +17,13 @@ package singleflight import ( - "errors" "fmt" "sync" "sync/atomic" "testing" "time" + + "github.com/cockroachdb/errors" ) func TestDo(t *testing.T) { diff --git a/pkg/util/sysutil/sysutil_windows.go b/pkg/util/sysutil/sysutil_windows.go index 3eee9ba528b6..3e3d967d12eb 100644 --- a/pkg/util/sysutil/sysutil_windows.go +++ b/pkg/util/sysutil/sysutil_windows.go @@ -13,11 +13,12 @@ package sysutil import ( - "errors" "fmt" "os" "os/user" "syscall" + + "github.com/cockroachdb/errors" ) // ProcessIdentity returns a string describing the user and group that this diff --git a/pkg/util/timeutil/zoneinfo.go b/pkg/util/timeutil/zoneinfo.go index ee55e5504411..e25070f30b78 100644 --- a/pkg/util/timeutil/zoneinfo.go +++ b/pkg/util/timeutil/zoneinfo.go @@ -11,9 +11,10 @@ package timeutil import ( - "errors" "strings" "time" + + "github.com/cockroachdb/errors" ) var errTZDataNotFound = errors.New("timezone data cannot be found")