joao-r-reis commented on code in PR #1836:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1836#discussion_r1928877612
##########
host_source.go:
##########
@@ -87,13 +88,29 @@ func (c *cassVersion) unmarshal(data []byte) error {
c.Minor, err = strconv.Atoi(v[1])
if err != nil {
- return fmt.Errorf("invalid minor version %v: %v", v[1], err)
+ vMinor := strings.Split(v[1], "-")
+ if len(vMinor) < 2 {
+ return fmt.Errorf("invalid minor version %v: %v", v[1],
err)
+ }
+ c.Minor, err = strconv.Atoi(vMinor[0])
+ if err != nil {
+ return fmt.Errorf("invalid minor version %v: %v", v[1],
err)
+ }
+ c.AdditionalNotation = vMinor[1]
Review Comment:
Should return here as we're parsing the qualifier which should always be at
the end.
Also if the "suffix" of the version is something like
`-qualifier1-qualifier2` we want this field to either contain the full suffix
string `-qualifier1-qualifier2` or this field should be of type `[]string` and
the slice should be `[qualifier1,qualifier2]`. [Here's the relevant code in the
java
driver](https://github.com/apache/cassandra-java-driver/blob/4.x/core/src/main/java/com/datastax/oss/driver/api/core/Version.java#L122-L126).
Personally I think it's fine if we just parse the full suffix string
including the first `-`, if anyone is actually interested in parsing these
qualifiers then they can do it on their app. In this case the name of the field
should probably be `Suffix` instead of `Qualifier` though I think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]