MCPcopy Create free account
hub / github.com/conforma/cli / restoreInto

Function restoreInto

acceptance/testenv/testenv.go:106–127  ·  view source on GitHub ↗

RestoreValue returns the value associated with the given key from the last preserved environment

(key string, val any)

Source from the content-addressed store, hash-verified

104
105// RestoreValue returns the value associated with the given key from the last preserved environment
106func restoreInto(key string, val any) error {
107 b, err := loader(persistedFile)
108 if err != nil {
109 if os.IsNotExist(err) {
110 return nil
111 }
112
113 return err
114 }
115
116 var j map[string]json.RawMessage
117
118 if err = json.Unmarshal(b, &j); err != nil {
119 return err
120 }
121
122 if err = json.Unmarshal(j[key], &val); err != nil {
123 return err
124 }
125
126 return nil
127}
128
129// WithState marks a struct that holds some state under a specific key
130type WithState interface {

Callers 1

SetupStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected