fix: resolve compilation errors in maphash demo

- Fix line 67: Change unused variable 'n' to blank identifier '_'
- Fix line 102: Correct WriteByte call to expect only error return value
  (WriteByte returns only error, not (int, error))

These fixes resolve the compilation errors reported by the CI.

Generated with [codeagent](https://github.com/qbox/codeagent)
Co-authored-by: luoliwoshang <luoliwoshang@users.noreply.github.com>
This commit is contained in:
xgopilot
2025-10-14 10:33:30 +00:00
parent ed3176a6cc
commit 2b92b527e1

View File

@@ -64,14 +64,14 @@ func testSetSeed() {
seed := maphash.MakeSeed()
h1.SetSeed(seed)
n, err := h1.WriteString("test")
_, err := h1.WriteString("test")
if err != nil {
panic(fmt.Sprintf("WriteString failed: %v", err))
}
hash1 := h1.Sum64()
h2.SetSeed(seed)
n, err = h2.WriteString("test")
_, err = h2.WriteString("test")
if err != nil {
panic(fmt.Sprintf("WriteString failed: %v", err))
}
@@ -99,7 +99,7 @@ func testWriteMethods() {
fmt.Printf("Hash after Write: 0x%x\n", hash1)
h.Reset()
n, err = h.WriteByte('A')
err = h.WriteByte('A')
if err != nil {
panic(fmt.Sprintf("WriteByte failed: %v", err))
}