MCPcopy
hub / github.com/tailscale/tailscale / sumFile

Function sumFile

cmd/gitops-pusher/gitops-pusher.go:274–292  ·  view source on GitHub ↗
(fname string)

Source from the content-addressed store, hash-verified

272}
273
274func sumFile(fname string) (string, error) {
275 data, err := os.ReadFile(fname)
276 if err != nil {
277 return "", err
278 }
279
280 formatted, err := hujson.Format(data)
281 if err != nil {
282 return "", err
283 }
284
285 h := sha256.New()
286 _, err = h.Write(formatted)
287 if err != nil {
288 return "", err
289 }
290
291 return fmt.Sprintf("%x", h.Sum(nil)), nil
292}
293
294func applyNewACL(ctx context.Context, tailnet, policyFname, oldEtag string) error {
295 client, apiKey := getCredentials()

Callers 3

applyFunction · 0.85
testFunction · 0.85
getChecksumsFunction · 0.85

Calls 5

ReadFileMethod · 0.65
WriteMethod · 0.65
FormatMethod · 0.45
NewMethod · 0.45
SumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…