gonum icon indicating copy to clipboard operation
gonum copied to clipboard

Cannot marshal JSON when enum has zero value

Open steinfletcher opened this issue 4 years ago • 0 comments

Blows up here when enum has zero value

// Description returns the enum description if present. If no description is defined an empty string is returned
func (g PublishedState) Description() string {
	switch g {
	case PublishedStatePrivate:
		return ""
	case PublishedStatePublished:
		return ""
	case PublishedStateUnderReview:
		return ""
	default:
		panic("Could not map enum description")
	}
}

steinfletcher avatar Jan 01 '20 09:01 steinfletcher