Closed Techno-Fox closed 3 years ago
Hi @Techno-Fox thanks for the report! I'll have a look ASAP! I wonder if we have a way to test more comprehensively to prevent these issues to resurface. I'll spend some time thinking about it.
This time I reviewed all the types implementing MarshalJSON
and added tests for all of them:
pkg/block/block.go:46: // DriveType::MarshalJSON.
pkg/block/block.go:64:func (dt DriveType) MarshalJSON() ([]byte, error) {
pkg/block/block.go:111: // StorageController::MarshalJSON.
pkg/block/block.go:144:func (sc StorageController) MarshalJSON() ([]byte, error) {
pkg/memory/memory_cache.go:36: // CacheType:MarshalJSON.
pkg/memory/memory_cache.go:52:func (a CacheType) MarshalJSON() ([]byte, error) {
pkg/pci/pci.go:76:func (d *Device) MarshalJSON() ([]byte, error) {
pkg/topology/topology.go:43: // Architecture:MarshalJSON.
pkg/topology/topology.go:58:func (a Architecture) MarshalJSON() ([]byte, error) {
This is a new one that came up. I noticed my structure wouldn't Unmarshal.
This was the error: json: cannot unmarshal string into Go struct field Info.architecture of type topology.Architecture
Example: