MCPcopy Create free account
hub / github.com/cli/cli / writeManifest

Function writeManifest

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

Source from the content-addressed store, hash-verified

393}
394
395func writeManifest(dir, name string, data []byte) (writeErr error) {
396 path := filepath.Join(dir, name)
397 var f *os.File
398 if f, writeErr = os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600); writeErr != nil {
399 writeErr = fmt.Errorf("failed to open manifest for writing: %w", writeErr)
400 return
401 }
402 defer func() {
403 if err := f.Close(); writeErr == nil && err != nil {
404 writeErr = err
405 }
406 }()
407 if _, writeErr = f.Write(data); writeErr != nil {
408 writeErr = fmt.Errorf("failed write manifest file: %w", writeErr)
409 }
410 return
411}
412
413func (m *Manager) installGit(repo ghrepo.Interface, target string) error {
414 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