MCPcopy Index your code
hub / github.com/cli/cli / writeTo

Function writeTo

internal/skills/lockfile/lockfile.go:78–92  ·  view source on GitHub ↗

writeTo persists the lock file through an open file handle.

(f *os.File, lf *file)

Source from the content-addressed store, hash-verified

76
77// writeTo persists the lock file through an open file handle.
78func writeTo(f *os.File, lf *file) error {
79 data, err := json.MarshalIndent(lf, "", " ")
80 if err != nil {
81 return err
82 }
83
84 if _, err := f.Seek(0, 0); err != nil {
85 return err
86 }
87 if err := f.Truncate(0); err != nil {
88 return err
89 }
90 _, err = f.Write(data)
91 return err
92}
93
94// RecordInstall adds or updates a skill entry in the lock file.
95// It uses a file-based lock to prevent concurrent read-modify-write races

Callers 1

RecordInstallFunction · 0.85

Calls 1

WriteMethod · 0.65

Tested by

no test coverage detected