Skip to content

Flatten with empty slice in struct yields wrong number of arguments #330

@dokterbob

Description

@dokterbob

A struct of the form:

struct {
	Other  string
	Nested []string
}

with with Nested left to it's empty value, generates an invalid number of arguments for HMSET, leading to the error:
unmarshaling message off Conn: ERR wrong number of arguments for 'hmset' command

Suggested solutions:

  1. Defaulting for Nested to an empty string "" for empty values, consistent with normal empty string values, explicitly emptying the value.
  2. Adding an omitempty option, preventing this value from being (over)written with HMSET.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions