diff --git a/api/api.go b/api/api.go index e3ad60f..9fe44ed 100644 --- a/api/api.go +++ b/api/api.go @@ -19,8 +19,8 @@ import ( type Options struct { CacheFiles bool - MinWidth int - MaxWidth int + MinWidth int + MaxWidth int MinHeight int MaxHeight int } @@ -32,18 +32,18 @@ const ( type API struct { mngr *manager.Manager - pr image.Processor - opt *Options + pr image.Processor + opt *Options } func New(manager *manager.Manager, imageProcessor image.Processor, options *Options) *API { if options == nil { options = &Options{ CacheFiles: true, - MinWidth: minSize, - MinHeight: minSize, - MaxWidth: maxSize, - MaxHeight: maxSize, + MinWidth: minSize, + MinHeight: minSize, + MaxWidth: maxSize, + MaxHeight: maxSize, } } else { if options.MinWidth == 0 { @@ -65,8 +65,8 @@ func New(manager *manager.Manager, imageProcessor image.Processor, options *Opti return &API{ mngr: manager, - pr: imageProcessor, - opt: options, + pr: imageProcessor, + opt: options, } } @@ -198,11 +198,11 @@ func cacheFile(cp string, i []byte) error { func cachePath(file string, width, height int) string { tmp := strings.Split(file, "/") - tmp[len(tmp) - 1] = fmt.Sprintf("%s/%dx%d/%s", ".cache", width, height, tmp[len(tmp) - 1]) + tmp[len(tmp)-1] = fmt.Sprintf("%s/%dx%d/%s", ".cache", width, height, tmp[len(tmp)-1]) return strings.Join(tmp, "/") } func path(file string) string { tmp := strings.Split(file, "/") - return strings.Join(tmp[:len(tmp) - 1], "/") -} \ No newline at end of file + return strings.Join(tmp[:len(tmp)-1], "/") +} diff --git a/api/types.go b/api/types.go index 36206cb..b29e51d 100644 --- a/api/types.go +++ b/api/types.go @@ -2,4 +2,4 @@ package api type Error struct { Message string `json:"message"` -} \ No newline at end of file +} diff --git a/image/image.go b/image/image.go index 4dab8f8..d81bb93 100644 --- a/image/image.go +++ b/image/image.go @@ -22,4 +22,4 @@ func Decode(name string) (*image.Image, error) { } return &img, nil -} \ No newline at end of file +} diff --git a/image/imaging.go b/image/imaging.go index e1180da..d48e129 100644 --- a/image/imaging.go +++ b/image/imaging.go @@ -5,7 +5,7 @@ import ( "image" ) -type Imaging struct {} +type Imaging struct{} func (i *Imaging) CropCenter(img image.Image, width, height int) *image.Image { img = imaging.Fill(img, width, height, imaging.Center, imaging.Lanczos) diff --git a/main.go b/main.go index 9101a9c..d235efe 100644 --- a/main.go +++ b/main.go @@ -57,4 +57,3 @@ func main() { log.Panic("HTTP server failed to start") } } - diff --git a/manager/manager.go b/manager/manager.go index 8a719c9..25001c9 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -12,8 +12,8 @@ const ( type Manager struct { base string - ds map[string][]string - mc []string // index of categories + ds map[string][]string + mc []string // index of categories } func New(dir string) (*Manager, error) { @@ -29,12 +29,11 @@ func New(dir string) (*Manager, error) { return &Manager{ base: dir, - ds: ds, - mc: mc, + ds: ds, + mc: mc, }, nil } - func (m *Manager) Pick(cat string) string { if cat == "" { cat = m.randomCategory() @@ -68,4 +67,4 @@ func (m *Manager) randomEntity(c string) string { names = append(names, m.ds[c][rand.Intn(len(m.ds[c]))]) return strings.Join(names, "/") -} \ No newline at end of file +}