summaryrefslogtreecommitdiff
path: root/identify.go
blob: 60ea616c88f3dd287329e7816375b79fbbefaba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package filepb

// print the protobuf in human form
func IdentifyPB(filename string) (string, string, error) {
	data, err := os.ReadFile(filename)
	if err != nil {
		// log.Info("open config file :", err)
		return "os.ReadFile()", err
	}

	var pb *Identify
	pb = new(Identify)
	if err := pb.Unmarshal(data); err != nil {
		return "Unmarshal(data)", err
	}
	log.Info("Identify protobuf file uuid =", pb.Uuid, "version =", pb.Version)
	return pb.uuid, pb.Version, nil
}