Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update driver name after ASF donation #1817

Closed
wants to merge 2 commits into from

Conversation

absurdfarce
Copy link
Contributor

@absurdfarce absurdfarce commented Sep 5, 2024

Issue originally identified by @tolbertam

Update the driver name to allow servers to clearly distinguish between gocql and cassandra-gocql-driver. Note that something similar was done for the Java driver when it was donated.

version.go Outdated
@@ -27,7 +27,7 @@ package gocql
import "runtime/debug"

const (
mainModule = "github.com/gocql/gocql"
mainModule = "github.com/apache/cassandra-gocql-driver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested this? It's using this string to match the dependency path but I'm not sure where the dependency path comes from. If it comes from the actual module name then I don't think this will work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It comes from the module name as defined in go.mod, which won't change until v2.

The reason why it checks BuildInfo is so that when someone uses a fork with the replace directive, the replaced version/path is used.

We need to keep mainModule intact and do

driverName = "github.com/apache/cassandra-gocql-driver"

instead of

driverName = mainModule

Copy link
Contributor

@joao-r-reis joao-r-reis Sep 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if d.Path == mainModule {
  driverName = "github.com/apache/cassandra-gocql-driver"
  driverVersion = d.Version
  if d.Replace != nil {
	  driverName = d.Replace.Path
	  driverVersion = d.Replace.Version
  }
  break
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 No, really... this is what I get for rushing. Completely agree that "mainModule" is entirely the wrong name here although I still think that there's merit in encapsulating that value in a constant, albeit a better-named constant.

I'll tweak this a bit and see if I can come up with something that (a) is clearer and (b) is very much in the spirit of what's proposed above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could rename mainModule to upstreamModule ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just "mainPacakge"? That has the advantage of matching the terminology in the runtime/debug docs... ?

Copy link
Contributor

@joao-r-reis joao-r-reis Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package in the Go land means something different than module, in this case it's referring to the module so I'm fine with keeping it mainModule or renaming it to upstreamModule, both work for me.

Copy link
Contributor

@joao-r-reis joao-r-reis Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait we're looking at d.Path instead of d.Main, in that case it is referring to the package you're right.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainPackage or upstreamPackage would be more suitable then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joao-r-reis . I kinda like "mainPackage" in this case so I ran with it... if anybody has objections let me know!

@@ -27,7 +27,7 @@ package gocql
import "runtime/debug"

const (
mainModule = "github.com/gocql/gocql"
defaultDriverName = "github.com/apache/cassandra-gocql-driver"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows us to contain the default value in a distinct location (i.e. not embedded within the code below) with a much more descriptive name.

version.go Outdated Show resolved Hide resolved
Copy link
Contributor

@martin-sucha martin-sucha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you!

@martin-sucha
Copy link
Contributor

Please squash the commits and update the commit message:

https://github.com/apache/cassandra-gocql-driver/blob/trunk/CONTRIBUTING.md#commit-message

absurdfarce added a commit to absurdfarce/cassandra-gocql-driver that referenced this pull request Sep 10, 2024
patch by Bret McGuire; reviewed by Joao Reis, Martin Sucha, Bret McGuire
reference: apache#1817
@@ -38,8 +44,8 @@ func init() {
buildInfo, ok := debug.ReadBuildInfo()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there was some confusion in the PR it would be good to document the point of this code especially as it relates to the replace directive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be addressed below... let me know if you were thinking of something else @jameshartig !

Copy link
Contributor

@jameshartig jameshartig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM but I do think some comments would've gone a long way in clarifying what this is trying to do.

Copy link
Contributor

@tolbertam tolbertam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you for taking care of this!

patch by Bret McGuire; reviewed by Joao Reis, Martin Sucha, Andy Tolbert and James Hartig
reference: apache#1817
@absurdfarce
Copy link
Contributor Author

@tolbertam The test failures here seem to be coming from expired certs for TLS tests. Is fixing that just a matter of getting #1805 merged?

@tolbertam
Copy link
Contributor

That's right @absurdfarce , #1805 aims to resolve the issues around the certs used by the tests expiring.

@absurdfarce
Copy link
Contributor Author

Thanks @tolbertam! I'm gonna merge #1805 and confirm that that addresses the test failures before calling this one good.

absurdfarce added a commit to absurdfarce/cassandra-gocql-driver that referenced this pull request Sep 20, 2024
patch by Bret McGuire; reviewed by Joao Reis, Martin Sucha, Andy Tolbert and James Hartig
reference: apache#1817
@absurdfarce
Copy link
Contributor Author

Bah, I mucked this up with the merge commit 🤦 . Closing this out and replacing it with #1824

absurdfarce added a commit that referenced this pull request Sep 20, 2024
patch by Bret McGuire; reviewed by Joao Reis, Martin Sucha, Andy Tolbert and James Hartig
reference: #1817
@absurdfarce absurdfarce deleted the asf-driver-name branch September 20, 2024 23:13
Rikkuru pushed a commit to Rikkuru/cassandra-gocql-driver that referenced this pull request Nov 9, 2024
patch by Bret McGuire; reviewed by Joao Reis, Martin Sucha, Andy Tolbert and James Hartig
reference: apache#1817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants