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

Function writeManifest

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

Source from the content-addressed store, hash-verified

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