Repository: tikv/client-go
Pull request #183 (2021-06-26 12:10:31)

*: move locate to internal package
Signed-off-by: disksing <i@disksing.com>

Fix https://github.com/tikv/client-go/issues/182


Patch:
diff --git a/locate/accessmode.go b/internal/locate/accessmode.go
similarity index 100%
rename from locate/accessmode.go
rename to internal/locate/accessmode.go
diff --git a/locate/main_test.go b/internal/locate/main_test.go
similarity index 100%
rename from locate/main_test.go
rename to internal/locate/main_test.go
diff --git a/locate/pd_codec.go b/internal/locate/pd_codec.go
similarity index 100%
rename from locate/pd_codec.go
rename to internal/locate/pd_codec.go
diff --git a/locate/region_cache.go b/internal/locate/region_cache.go
similarity index 100%
rename from locate/region_cache.go
rename to internal/locate/region_cache.go
diff --git a/locate/region_cache_test.go b/internal/locate/region_cache_test.go
similarity index 100%
rename from locate/region_cache_test.go
rename to internal/locate/region_cache_test.go
diff --git a/locate/region_request.go b/internal/locate/region_request.go
similarity index 100%
rename from locate/region_request.go
rename to internal/locate/region_request.go
diff --git a/locate/region_request3_test.go b/internal/locate/region_request3_test.go
similarity index 100%
rename from locate/region_request3_test.go
rename to internal/locate/region_request3_test.go
diff --git a/locate/region_request_test.go b/internal/locate/region_request_test.go
similarity index 100%
rename from locate/region_request_test.go
rename to internal/locate/region_request_test.go
diff --git a/tikv/2pc.go b/tikv/2pc.go
index 688c6b3..8d0707c 100644
--- a/tikv/2pc.go
+++ b/tikv/2pc.go
@@ -51,8 +51,8 @@ import (
 	"github.com/tikv/client-go/v2/client"
 	"github.com/tikv/client-go/v2/config"
 	tikverr "github.com/tikv/client-go/v2/error"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/kv"
-	"github.com/tikv/client-go/v2/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/oracle"
diff --git a/tikv/client_helper.go b/tikv/client_helper.go
index ff6a2d3..dc656c2 100644
--- a/tikv/client_helper.go
+++ b/tikv/client_helper.go
@@ -35,7 +35,7 @@ package tikv
 import (
 	"time"
 
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/tikvrpc"
 	"github.com/tikv/client-go/v2/util"
 )
diff --git a/tikv/commit.go b/tikv/commit.go
index bdeb706..00d28c3 100644
--- a/tikv/commit.go
+++ b/tikv/commit.go
@@ -42,7 +42,7 @@ import (
 	"github.com/prometheus/client_golang/prometheus"
 	"github.com/tikv/client-go/v2/client"
 	tikverr "github.com/tikv/client-go/v2/error"
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/retry"
diff --git a/tikv/gc.go b/tikv/gc.go
index 1aa00bb..5e988f9 100644
--- a/tikv/gc.go
+++ b/tikv/gc.go
@@ -20,8 +20,8 @@ import (
 	"github.com/pingcap/errors"
 	"github.com/pingcap/kvproto/pkg/kvrpcpb"
 	tikverr "github.com/tikv/client-go/v2/error"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/kv"
-	"github.com/tikv/client-go/v2/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/retry"
 	"github.com/tikv/client-go/v2/tikvrpc"
diff --git a/tikv/interface.go b/tikv/interface.go
index 4f3699a..6a9cb44 100644
--- a/tikv/interface.go
+++ b/tikv/interface.go
@@ -35,7 +35,7 @@ package tikv
 import (
 	"time"
 
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/oracle"
 	"github.com/tikv/client-go/v2/tikvrpc"
 )
diff --git a/tikv/kv.go b/tikv/kv.go
index f6625c8..aa2fd7f 100644
--- a/tikv/kv.go
+++ b/tikv/kv.go
@@ -50,9 +50,9 @@ import (
 	"github.com/tikv/client-go/v2/client"
 	"github.com/tikv/client-go/v2/config"
 	tikverr "github.com/tikv/client-go/v2/error"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/kv"
 	"github.com/tikv/client-go/v2/latch"
-	"github.com/tikv/client-go/v2/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/oracle"
diff --git a/tikv/lock_resolver.go b/tikv/lock_resolver.go
index e0d623f..4d51943 100644
--- a/tikv/lock_resolver.go
+++ b/tikv/lock_resolver.go
@@ -47,7 +47,7 @@ import (
 	"github.com/tikv/client-go/v2/client"
 	"github.com/tikv/client-go/v2/config"
 	tikverr "github.com/tikv/client-go/v2/error"
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/oracle"
diff --git a/tikv/pessimistic.go b/tikv/pessimistic.go
index ad463e8..c719c8b 100644
--- a/tikv/pessimistic.go
+++ b/tikv/pessimistic.go
@@ -44,8 +44,8 @@ import (
 	"github.com/prometheus/client_golang/prometheus"
 	"github.com/tikv/client-go/v2/client"
 	tikverr "github.com/tikv/client-go/v2/error"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/kv"
-	"github.com/tikv/client-go/v2/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/retry"
diff --git a/tikv/prewrite.go b/tikv/prewrite.go
index d86b265..e33ffaf 100644
--- a/tikv/prewrite.go
+++ b/tikv/prewrite.go
@@ -45,7 +45,7 @@ import (
 	"github.com/tikv/client-go/v2/client"
 	"github.com/tikv/client-go/v2/config"
 	tikverr "github.com/tikv/client-go/v2/error"
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/retry"
diff --git a/tikv/rawkv.go b/tikv/rawkv.go
index db85b56..88ae664 100644
--- a/tikv/rawkv.go
+++ b/tikv/rawkv.go
@@ -42,7 +42,7 @@ import (
 	"github.com/tikv/client-go/v2/client"
 	"github.com/tikv/client-go/v2/config"
 	tikverr "github.com/tikv/client-go/v2/error"
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/retry"
 	"github.com/tikv/client-go/v2/tikvrpc"
diff --git a/tikv/region.go b/tikv/region.go
index ec54a2a..8d48c71 100644
--- a/tikv/region.go
+++ b/tikv/region.go
@@ -37,7 +37,7 @@ import (
 
 	"github.com/pingcap/kvproto/pkg/metapb"
 	"github.com/tikv/client-go/v2/client"
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/tikvrpc"
 	pd "github.com/tikv/pd/client"
 )
diff --git a/tikv/scan.go b/tikv/scan.go
index 0421c1d..8a40431 100644
--- a/tikv/scan.go
+++ b/tikv/scan.go
@@ -40,8 +40,8 @@ import (
 	"github.com/pingcap/kvproto/pkg/kvrpcpb"
 	"github.com/tikv/client-go/v2/client"
 	tikverr "github.com/tikv/client-go/v2/error"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/kv"
-	"github.com/tikv/client-go/v2/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/retry"
 	"github.com/tikv/client-go/v2/tikvrpc"
diff --git a/tikv/snapshot.go b/tikv/snapshot.go
index e13fb7e..ff61713 100644
--- a/tikv/snapshot.go
+++ b/tikv/snapshot.go
@@ -48,8 +48,8 @@ import (
 	"github.com/pingcap/kvproto/pkg/metapb"
 	"github.com/tikv/client-go/v2/client"
 	tikverr "github.com/tikv/client-go/v2/error"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/kv"
-	"github.com/tikv/client-go/v2/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/metrics"
 	"github.com/tikv/client-go/v2/retry"
diff --git a/tikv/split_region.go b/tikv/split_region.go
index 64377b5..d988513 100644
--- a/tikv/split_region.go
+++ b/tikv/split_region.go
@@ -45,8 +45,8 @@ import (
 	"github.com/pingcap/kvproto/pkg/pdpb"
 	"github.com/tikv/client-go/v2/client"
 	tikverr "github.com/tikv/client-go/v2/error"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/kv"
-	"github.com/tikv/client-go/v2/locate"
 	"github.com/tikv/client-go/v2/logutil"
 	"github.com/tikv/client-go/v2/retry"
 	"github.com/tikv/client-go/v2/tikvrpc"


Test patch:
diff --git a/tikv/test_probe.go b/tikv/test_probe.go
index 573e64c..0798da8 100644
--- a/tikv/test_probe.go
+++ b/tikv/test_probe.go
@@ -41,7 +41,7 @@ import (
 	"github.com/pingcap/errors"
 	"github.com/pingcap/kvproto/pkg/kvrpcpb"
 	"github.com/pingcap/kvproto/pkg/metapb"
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	"github.com/tikv/client-go/v2/retry"
 	"github.com/tikv/client-go/v2/tikvrpc"
 	"github.com/tikv/client-go/v2/unionstore"
diff --git a/tikv/test_util.go b/tikv/test_util.go
index 337cf3d..19ae713 100644
--- a/tikv/test_util.go
+++ b/tikv/test_util.go
@@ -37,7 +37,7 @@ import (
 
 	"github.com/google/uuid"
 	"github.com/pingcap/errors"
-	"github.com/tikv/client-go/v2/locate"
+	"github.com/tikv/client-go/v2/internal/locate"
 	pd "github.com/tikv/pd/client"
 )