MCPcopy Index your code
hub / github.com/evilsocket/sum / Load

Function Load

storage/loader.go:49–60  ·  view source on GitHub ↗

Load reads and deserializes a file into a generic protobuf message.

(fileName string, m proto.Message)

Source from the content-addressed store, hash-verified

47
48// Load reads and deserializes a file into a generic protobuf message.
49func Load(fileName string, m proto.Message) error {
50 data, err := ioutil.ReadFile(fileName)
51 if err != nil {
52 return fmt.Errorf("error while reading %s: %s", fileName, err)
53 }
54
55 err = proto.Unmarshal(data, m)
56 if err != nil {
57 return fmt.Errorf("error while deserializing %s: %s", fileName, err)
58 }
59 return nil
60}

Callers 5

LoadMethod · 0.85
TestLoaderLoadFunction · 0.85
TestLoaderLoadWithErrorFunction · 0.85
BenchmarkLoaderLoadFunction · 0.85
TestStorageFlushAndBackFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestLoaderLoadFunction · 0.68
TestLoaderLoadWithErrorFunction · 0.68
BenchmarkLoaderLoadFunction · 0.68
TestStorageFlushAndBackFunction · 0.68