1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Moved commonly use file operations to separate package.

This commit is contained in:
Sascha L. Teichmann 2021-12-09 11:55:22 +01:00
parent 9d0ed98a17
commit 2fb2dfda78
7 changed files with 151 additions and 127 deletions

View file

@ -5,6 +5,8 @@ import (
"io"
"sort"
"time"
"github.com/csaf-poc/csaf_distribution/util"
)
// Link for ROLIE.
@ -70,11 +72,11 @@ func LoadROLIEFeed(r io.Reader) (*ROLIEFeed, error) {
// WriteTo saves a ROLIE feed to a writer.
func (rf *ROLIEFeed) WriteTo(w io.Writer) (int64, error) {
nw := nWriter{w, 0}
nw := util.NWriter{w, 0}
enc := json.NewEncoder(&nw)
enc.SetIndent("", " ")
err := enc.Encode(rf)
return nw.n, err
return nw.N, err
}
// EntryByID looks up an entry by its ID.