File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,13 @@ package gocql
27
27
import "runtime/debug"
28
28
29
29
const (
30
- mainModule = "github.com/gocql/gocql"
30
+ defaultDriverName = "github.com/apache/cassandra-gocql-driver"
31
+
32
+ // This string MUST have this value since we explicitly test against the
33
+ // current main package returned by runtime/debug below. Also note the
34
+ // package name used here may change in a future (2.x) release; in that case
35
+ // this constant will be updated as well.
36
+ mainPackage = "github.com/gocql/gocql"
31
37
)
32
38
33
39
var driverName string
@@ -38,9 +44,13 @@ func init() {
38
44
buildInfo , ok := debug .ReadBuildInfo ()
39
45
if ok {
40
46
for _ , d := range buildInfo .Deps {
41
- if d .Path == mainModule {
42
- driverName = mainModule
47
+ if d .Path == mainPackage {
48
+ driverName = defaultDriverName
43
49
driverVersion = d .Version
50
+ // If there's a replace directive in play for the gocql package
51
+ // then use that information for path and version instead. This
52
+ // will allow forks or other local packages to clearly identify
53
+ // themselves as distinct from mainPackage above.
44
54
if d .Replace != nil {
45
55
driverName = d .Replace .Path
46
56
driverVersion = d .Replace .Version
You can’t perform that action at this time.
0 commit comments