This is an automated email from the ASF dual-hosted git repository.
maciej pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new 601e59776 feat(go): send SDK version in login request (#3025)
601e59776 is described below
commit 601e59776ad5aaaf12218d9c72d40649bf770270
Author: Ryan Huang <[email protected]>
AuthorDate: Wed Mar 25 23:03:59 2026 +0800
feat(go): send SDK version in login request (#3025)
---
foreign/go/contracts/version.go | 2 --
foreign/go/internal/command/session.go | 4 ++-
.../command/session_test.go} | 37 +++++++++++++++++++---
3 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/foreign/go/contracts/version.go b/foreign/go/contracts/version.go
index 10844b450..07b4448b0 100644
--- a/foreign/go/contracts/version.go
+++ b/foreign/go/contracts/version.go
@@ -17,6 +17,4 @@
package iggcon
-// TODO: Wire Version into binary_serialization/log_in_request_serializer.go
-// to send the actual SDK version during login instead of an empty string.
const Version = "0.7.1-edge.1"
diff --git a/foreign/go/internal/command/session.go
b/foreign/go/internal/command/session.go
index 606ce8821..9dfedae33 100644
--- a/foreign/go/internal/command/session.go
+++ b/foreign/go/internal/command/session.go
@@ -19,6 +19,8 @@ package command
import (
"encoding/binary"
+
+ iggcon "github.com/apache/iggy/foreign/go/contracts"
)
type LoginUser struct {
@@ -33,7 +35,7 @@ func (lu *LoginUser) Code() Code {
func (lu *LoginUser) MarshalBinary() ([]byte, error) {
usernameBytes := []byte(lu.Username)
passwordBytes := []byte(lu.Password)
- versionBytes := []byte("")
+ versionBytes := []byte(iggcon.Version)
contextBytes := []byte("")
// Calculate total length
diff --git a/foreign/go/contracts/version.go
b/foreign/go/internal/command/session_test.go
similarity index 50%
copy from foreign/go/contracts/version.go
copy to foreign/go/internal/command/session_test.go
index 10844b450..664623229 100644
--- a/foreign/go/contracts/version.go
+++ b/foreign/go/internal/command/session_test.go
@@ -15,8 +15,37 @@
// specific language governing permissions and limitations
// under the License.
-package iggcon
+package command
-// TODO: Wire Version into binary_serialization/log_in_request_serializer.go
-// to send the actual SDK version during login instead of an empty string.
-const Version = "0.7.1-edge.1"
+import (
+ "encoding/binary"
+ "testing"
+
+ iggcon "github.com/apache/iggy/foreign/go/contracts"
+)
+
+func TestSerialize_LoginUser_ContainsVersion(t *testing.T) {
+ request := LoginUser{
+ Username: "iggy",
+ Password: "iggy",
+ }
+
+ serialized, err := request.MarshalBinary()
+ if err != nil {
+ t.Fatalf("Failed to serialize LoginUser: %v", err)
+ }
+
+ // Skip past username (1-byte len + "iggy") and password (1-byte len +
"iggy")
+ pos := 1 + len("iggy") + 1 + len("iggy")
+
+ // Read version length (u32 LE)
+ versionLen := binary.LittleEndian.Uint32(serialized[pos : pos+4])
+ pos += 4
+
+ // Read version string
+ version := string(serialized[pos : pos+int(versionLen)])
+
+ if version != iggcon.Version {
+ t.Errorf("Version mismatch. Expected: %q, Got: %q",
iggcon.Version, version)
+ }
+}