Skip to content

Commit

Permalink
Refactored interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ymkjp committed Feb 15, 2019
1 parent ed513d3 commit 7c86ccf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions al2/web/albert_sites.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 3 additions & 3 deletions al2/web/alfred_sites.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"bytes"
"github.com/DHowett/go-plist"
"github.com/google/uuid"
"os"
"io"
)

type CustomSites map[string]*SiteConfig
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
}
Expand Down

0 comments on commit 7c86ccf

Please sign in to comment.