~egtann/up

ref: e0094c2d396c40d9b217e16605545b83ed0985b4 up/inventory.go -rw-r--r-- 291 bytes
e0094c2d — Evan Tann update license to openbsd isc 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package up

import (
	"encoding/json"
	"fmt"
	"io"
)

type Inventory map[string][]string

func ParseInventory(rdr io.Reader) (Inventory, error) {
	inv := Inventory{}
	if err := json.NewDecoder(rdr).Decode(&inv); err != nil {
		return nil, fmt.Errorf("decode: %w", err)
	}
	return inv, nil
}