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

import (
	"os"
)

// 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 "", "", err
	}

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