From 2ed76f1e4cb3fbd039e08c1e69de4606c3b45bb7 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 8 Oct 2014 16:15:54 +0400 Subject: [PATCH] Add method to convert reflist to list of strings. #116 --- deb/reflist.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/deb/reflist.go b/deb/reflist.go index f5e939ad..a5e9c1e1 100644 --- a/deb/reflist.go +++ b/deb/reflist.go @@ -92,6 +92,17 @@ func (l *PackageRefList) Has(p *Package) bool { return i < len(l.Refs) && bytes.Compare(l.Refs[i], key) == 0 } +// Strings builds list of strings with package keys +func (l *PackageRefList) Strings() []string { + result := make([]string, l.Len()) + + for i := 0; i < l.Len(); i++ { + result[i] = string(l.Refs[i]) + } + + return result +} + // Substract returns all packages in l that are not in r func (l *PackageRefList) Substract(r *PackageRefList) *PackageRefList { result := &PackageRefList{Refs: make([][]byte, 0, 128)}