From 7c86ccfaa0f1105aca8b22037e456d48e2b5d232 Mon Sep 17 00:00:00 2001 From: Kenta Yamamoto Date: Mon, 11 Feb 2019 16:08:46 +0900 Subject: [PATCH] Refactored interface --- al2/web/albert_sites.go | 6 +++--- al2/web/alfred_sites.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/al2/web/albert_sites.go b/al2/web/albert_sites.go index b7fba55..0aaf4b7 100644 --- a/al2/web/albert_sites.go +++ b/al2/web/albert_sites.go @@ -2,15 +2,15 @@ package web import ( "encoding/json" + "io" "io/ioutil" - "os" "strings" ) type AlbertSites []*SiteConfig -func (a *AlbertSites) Decode(file *os.File) error { - b, err := ioutil.ReadAll(file) +func (a *AlbertSites) Decode(r io.ReadSeeker) error { + b, err := ioutil.ReadAll(r) if err != nil { return err } diff --git a/al2/web/alfred_sites.go b/al2/web/alfred_sites.go index e8e92b1..594c7d1 100644 --- a/al2/web/alfred_sites.go +++ b/al2/web/alfred_sites.go @@ -4,7 +4,7 @@ import ( "bytes" "github.com/DHowett/go-plist" "github.com/google/uuid" - "os" + "io" ) type CustomSites map[string]*SiteConfig @@ -12,8 +12,8 @@ type AlfredSites struct { CustomSites `plist:"customSites"` } -func (a *AlfredSites) Decode(file *os.File) error { - decoder := plist.NewDecoder(file) +func (a *AlfredSites) Decode(r io.ReadSeeker) error { + decoder := plist.NewDecoder(r) if err := decoder.Decode(a); err != nil { return err }