MCPcopy
hub / github.com/getsops/sops / hashFile

Function hashFile

cmd/sops/edit.go:301–313  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

299}
300
301func hashFile(filePath string) ([]byte, error) {
302 var result []byte
303 file, err := os.Open(filePath)
304 if err != nil {
305 return result, err
306 }
307 defer file.Close()
308 hash := sha256.New()
309 if _, err := io.Copy(hash, file); err != nil {
310 return result, err
311 }
312 return hash.Sum(result), nil
313}
314
315func runEditor(path string) error {
316 envVar := "SOPS_EDITOR"

Callers 2

editTreeImplFunction · 0.85
runEditorUntilOkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected