From a48a468b2aa90e62f89ee153364a7fe5426ffce8 Mon Sep 17 00:00:00 2001 From: absurdfarce Date: Thu, 5 Sep 2024 11:44:24 -0500 Subject: [PATCH] Update driver name after ASF donation patch by Bret McGuire; reviewed by Joao Reis, Martin Sucha, Andy Tolbert and James Hartig reference: https://github.com/apache/cassandra-gocql-driver/pull/1817 --- version.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/version.go b/version.go index 140bae819..f2250f7fe 100644 --- a/version.go +++ b/version.go @@ -27,7 +27,13 @@ package gocql import "runtime/debug" const ( - mainModule = "github.com/gocql/gocql" + defaultDriverName = "github.com/apache/cassandra-gocql-driver" + + // This string MUST have this value since we explicitly test against the + // current main package returned by runtime/debug below. Also note the + // package name used here may change in a future (2.x) release; in that case + // this constant will be updated as well. + mainPackage = "github.com/gocql/gocql" ) var driverName string @@ -38,9 +44,13 @@ func init() { buildInfo, ok := debug.ReadBuildInfo() if ok { for _, d := range buildInfo.Deps { - if d.Path == mainModule { - driverName = mainModule + if d.Path == mainPackage { + driverName = defaultDriverName driverVersion = d.Version + // If there's a replace directive in play for the gocql package + // then use that information for path and version instead. This + // will allow forks or other local packages to clearly identify + // themselves as distinct from mainPackage above. if d.Replace != nil { driverName = d.Replace.Path driverVersion = d.Replace.Version