MCPcopy Index your code
hub / github.com/aptly-dev/aptly / loadKeyRing

Function loadKeyRing

pgp/internal.go:501–523  ·  view source on GitHub ↗
(name string, ignoreMissing bool)

Source from the content-addressed store, hash-verified

499var gnupgHome string
500
501func loadKeyRing(name string, ignoreMissing bool) (openpgp.EntityList, error) {
502 // if path doesn't contain slashes, treat it as relative to GnuPG home directory
503 if !strings.Contains(name, "/") {
504 name = filepath.Join(gnupgHome, name)
505 }
506
507 f, err := os.Open(name)
508 if err != nil {
509 if os.IsNotExist(err) {
510 if !ignoreMissing {
511 fmt.Printf("opengpg: failure opening keyring '%s': %s\n", name, err)
512 }
513 return nil, nil
514 }
515
516 return nil, err
517 }
518 defer func() {
519 _ = f.Close()
520 }()
521
522 return openpgp.ReadKeyRing(f)
523}
524
525func init() {
526 gnupgHome = os.Getenv("GNUPGHOME")

Callers 2

InitMethod · 0.85
InitKeyringMethod · 0.85

Calls 3

OpenMethod · 0.65
PrintfMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected