export loglist.Unmarshal

This commit is contained in:
Andrew Ayer 2021-05-01 16:53:56 -04:00
parent a147970db8
commit 4b280bdcd2
1 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ func Fetch(url string) (*List, error) {
if response.StatusCode != 200 { if response.StatusCode != 200 {
return nil, fmt.Errorf("%s: %s", url, response.Status) return nil, fmt.Errorf("%s: %s", url, response.Status)
} }
return unmarshal(content) return Unmarshal(content)
} }
func ReadFile(filename string) (*List, error) { func ReadFile(filename string) (*List, error) {
@ -46,10 +46,10 @@ func ReadFile(filename string) (*List, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return unmarshal(content) return Unmarshal(content)
} }
func unmarshal(jsonBytes []byte) (*List, error) { func Unmarshal(jsonBytes []byte) (*List, error) {
list := new(List) list := new(List)
if err := json.Unmarshal(jsonBytes, list); err != nil { if err := json.Unmarshal(jsonBytes, list); err != nil {
return nil, err return nil, err