github.com/quay/claircore@v1.5.28/debian/releases.go (about) 1 package debian 2 3 import ( 4 "fmt" 5 "strconv" 6 "sync" 7 8 "github.com/quay/claircore" 9 ) 10 11 var releases sync.Map 12 13 func mkDist(name string, ver int) *claircore.Distribution { 14 v, _ := releases.LoadOrStore(name, &claircore.Distribution{ 15 PrettyName: fmt.Sprintf("Debian GNU/Linux %d (%s)", ver, name), 16 Name: "Debian GNU/Linux", 17 VersionID: strconv.Itoa(ver), 18 Version: fmt.Sprintf("%d (%s)", ver, name), 19 VersionCodeName: name, 20 DID: "debian", 21 }) 22 return v.(*claircore.Distribution) 23 } 24 25 func getDist(name string) (*claircore.Distribution, error) { 26 v, ok := releases.Load(name) 27 if !ok { 28 return nil, fmt.Errorf("debian: unknown distribution %q", name) 29 } 30 return v.(*claircore.Distribution), nil 31 }