type ModulePublic … type ModuleError … type moduleErrorNoMethods … // UnmarshalJSON accepts both {"Err":"text"} and "text", // so that the output of go mod download -json can still // be unmarshaled into a ModulePublic during -reuse processing. func (e *ModuleError) UnmarshalJSON(data []byte) error { … } func (m *ModulePublic) String() string { … }