Cursor Code Issues Report: go-zenon

I’m working on the go-zenon code to add trusted and static nodes. Cursor is reporting a few problems with go-zenon that I wanted to report here.


Copy / paste from Cursor.

Code Issues Report: go-zenon Repository

Overview

The static code analysis has identified 4 issues in the codebase that need attention. These are primarily related to unused code and struct initialization patterns.

Issues Breakdown

In node/rpcstack.go (3 issues):

  1. Unused Function - func (*httpServer).listenAddr

    • Location: Line 96, Column 22
    • Error: Function is unused (U1000)
    • Impact: Dead code that could be removed
  2. Unused Function - func validatePrefix

    • Location: Line 213, Column 6
    • Error: Function is unused (U1000)
    • Impact: Dead code that could be removed
  3. Unused Function - func (*httpServer).stopWS

    • Location: Line 316, Column 22
    • Error: Function is unused (U1000)
    • Impact: Dead code that could be removed

In p2p/rlpx.go (1 issue):

  1. Struct Initialization - crypto/ecdsa.PublicKey
    • Location: Line 80, Column 10
    • Error: Struct literal uses unkeyed fields
    • Type: composites(default)
    • Impact: Potential maintenance and readability concerns

Recommendations

  1. For Unused Functions:

    • Either remove these functions if they are truly unnecessary
    • Or implement their usage if they are intended to be part of the API
    • Consider adding TODO comments if these are planned for future use
  2. For Struct Initialization:

    • Update the struct initialization to use keyed fields
    • Example:
      // Instead of:
      publicKey := ecdsa.PublicKey{/*...*/}
      
      // Use:
      publicKey := ecdsa.PublicKey{
          Curve: /*...*/,
          X: /*...*/,
          Y: /*...*/,
      }