Skip to content

Commit 5ed5e6d

Browse files
committed
Update driver name after ASF donation
patch by Bret McGuire; reviewed by Joao Reis, Martin Sucha, Andy Tolbert and James Hartig reference: #1817
1 parent f9b495b commit 5ed5e6d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

version.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ package gocql
2727
import "runtime/debug"
2828

2929
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"
3137
)
3238

3339
var driverName string
@@ -38,9 +44,13 @@ func init() {
3844
buildInfo, ok := debug.ReadBuildInfo()
3945
if ok {
4046
for _, d := range buildInfo.Deps {
41-
if d.Path == mainModule {
42-
driverName = mainModule
47+
if d.Path == mainPackage {
48+
driverName = defaultDriverName
4349
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.
4454
if d.Replace != nil {
4555
driverName = d.Replace.Path
4656
driverVersion = d.Replace.Version

0 commit comments

Comments
 (0)