Skip to content

Go SDK: stashgen cannot declare a UUID field, so generated code cannot store a UUID #1994

Backlog

Description

@coderdan

Background

The Go SDK is in languages/golang. stashgen reads a Go struct and generates the code (*_stash.go) that encrypts, decrypts and queries its fields. Each field gets a kind from the engine's list (record.Kind in languages/golang/internal/record/record.go), which is the type the engine seals the value as.

Problem

stashgen cannot declare a UUID field, so a Go program cannot store a UUID through generated code.

  • Verified: the engine and the Go guest store a UUID. A plan field of kind uuid is sealed, indexed for equality, queried and read back (a_uuid_field_round_trips_and_queries_by_equality in languages/golang/encrypt/guest/tests/native_ops.rs).
  • Verified: the Go module has the kind (record.UUID) and converts any [16]byte value, such as github.com/google/uuid.UUID, to one (gensupport.UUID).
  • Verified: stashgen has no Go type that maps to it. wireKind and kindOfWire in languages/golang/stashgen/engine.go have no UUID case, so a uuid.UUID field is generated as something else or refused.

This is the last Go part of #1821.

Proposal

  1. Map a field whose Go type is [16]byte, or a named type whose underlying type is [16]byte (such as uuid.UUID), to the uuid kind in stashgen, with an equality index allowed and an order index refused at generation time.
  2. Generate the conversion through gensupport.UUID on write and back to the field's own type on read.
  3. Add a stashgen test case under stashgen/testdata/cases, and a Go test that stores, queries by equality and reads a UUID field through generated code.
  4. Update languages/golang/CHANGELOG.md, and remove its note that stashgen does not yet map a Go type to a UUID.

Relationship to other work

Activity

  1. added
    enhancement
    Golang
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GolangSDKenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions