MCPcopy
hub / github.com/cli/cli / writeManifest

Function writeManifest

pkg/cmd/extension/manager.go:389–405  ·  view source on GitHub ↗
(dir, name string, data []byte)

Source from the content-addressed store, hash-verified

387}
388
389func writeManifest(dir, name string, data []byte) (writeErr error) {
390 path := filepath.Join(dir, name)
391 var f *os.File
392 if f, writeErr = os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600); writeErr != nil {
393 writeErr = fmt.Errorf("failed to open manifest for writing: %w", writeErr)
394 return
395 }
396 defer func() {
397 if err := f.Close(); writeErr == nil && err != nil {
398 writeErr = err
399 }
400 }()
401 if _, writeErr = f.Write(data); writeErr != nil {
402 writeErr = fmt.Errorf("failed write manifest file: %w", writeErr)
403 }
404 return
405}
406
407func (m *Manager) installGit(repo ghrepo.Interface, target string) error {
408 protocol := m.config.GitProtocol(repo.RepoHost()).Value

Callers 1

installBinMethod · 0.85

Calls 4

JoinMethod · 0.80
ErrorfMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected