From 09bac902d0a6158fe9f891658a2432cbb8214801 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 15 Jan 2020 19:59:25 +0100 Subject: [PATCH] Code clean-up (make fmt) Signed-off-by: Michael Mayer --- internal/api/geo.go | 6 +++--- internal/form/album_search.go | 10 ++++------ internal/form/label_search.go | 10 ++++------ internal/form/photo_search.go | 10 ++++------ internal/meta/data.go | 20 ++++++++++---------- internal/meta/exif.go | 3 --- internal/meta/xmp_document.go | 3 +-- pkg/pluscode/pluscode_test.go | 4 +--- pkg/s2/s2_test.go | 2 -- 9 files changed, 27 insertions(+), 41 deletions(-) diff --git a/internal/api/geo.go b/internal/api/geo.go index 521ac0c33..19185a2dc 100644 --- a/internal/api/geo.go +++ b/internal/api/geo.go @@ -11,7 +11,7 @@ import ( "github.com/gin-gonic/gin/binding" "github.com/photoprism/photoprism/internal/form" - "github.com/paulmach/go.geojson" + geojson "github.com/paulmach/go.geojson" ) // GET /api/v1/geo @@ -38,13 +38,13 @@ func GetGeo(router *gin.RouterGroup, conf *config.Config) { bbox := make([]float64, 4) - bboxMin := func (pos int, val float64) { + bboxMin := func(pos int, val float64) { if bbox[pos] == 0.0 || bbox[pos] > val { bbox[pos] = val } } - bboxMax := func (pos int, val float64) { + bboxMax := func(pos int, val float64) { if bbox[pos] == 0.0 || bbox[pos] < val { bbox[pos] = val } diff --git a/internal/form/album_search.go b/internal/form/album_search.go index 9250fdc0c..c27283653 100644 --- a/internal/form/album_search.go +++ b/internal/form/album_search.go @@ -2,15 +2,13 @@ package form // AlbumSearch represents search form fields for "/api/v1/albums". type AlbumSearch struct { - Query string `form:"q"` - + Query string `form:"q"` Slug string `form:"slug"` Name string `form:"name"` Favorites bool `form:"favorites"` - - Count int `form:"count" binding:"required"` - Offset int `form:"offset"` - Order string `form:"order"` + Count int `form:"count" binding:"required"` + Offset int `form:"offset"` + Order string `form:"order"` } func (f *AlbumSearch) GetQuery() string { diff --git a/internal/form/label_search.go b/internal/form/label_search.go index 774f19176..f9f969c8d 100644 --- a/internal/form/label_search.go +++ b/internal/form/label_search.go @@ -2,16 +2,14 @@ package form // PhotoSearch represents search form fields for "/api/v1/labels". type LabelSearch struct { - Query string `form:"q"` - + Query string `form:"q"` Slug string `form:"slug"` Name string `form:"name"` All bool `form:"all"` Favorites bool `form:"favorites"` - - Count int `form:"count" binding:"required"` - Offset int `form:"offset"` - Order string `form:"order"` + Count int `form:"count" binding:"required"` + Offset int `form:"offset"` + Order string `form:"order"` } func (f *LabelSearch) GetQuery() string { diff --git a/internal/form/photo_search.go b/internal/form/photo_search.go index e3baf2666..b8a74e036 100644 --- a/internal/form/photo_search.go +++ b/internal/form/photo_search.go @@ -6,8 +6,7 @@ import ( // PhotoSearch represents search form fields for "/api/v1/photos". type PhotoSearch struct { - Query string `form:"q"` - + Query string `form:"q"` Title string `form:"title"` Description string `form:"description"` Notes string `form:"notes"` @@ -39,10 +38,9 @@ type PhotoSearch struct { Story bool `form:"story"` Safe bool `form:"safe"` Nsfw bool `form:"nsfw"` - - Count int `form:"count" binding:"required"` - Offset int `form:"offset"` - Order string `form:"order"` + Count int `form:"count" binding:"required"` + Offset int `form:"offset"` + Order string `form:"order"` } func (f *PhotoSearch) GetQuery() string { diff --git a/internal/meta/data.go b/internal/meta/data.go index 72da79da1..353d8d5a0 100644 --- a/internal/meta/data.go +++ b/internal/meta/data.go @@ -21,14 +21,14 @@ type Data struct { Flash bool FocalLength int Exposure string - Aperture float64 - FNumber float64 - Iso int - Lat float64 - Lng float64 - Altitude int - Width int - Height int - Orientation int - All map[string]string + Aperture float64 + FNumber float64 + Iso int + Lat float64 + Lng float64 + Altitude int + Width int + Height int + Orientation int + All map[string]string } diff --git a/internal/meta/exif.go b/internal/meta/exif.go index 933d50b08..bd08dafb0 100644 --- a/internal/meta/exif.go +++ b/internal/meta/exif.go @@ -9,9 +9,6 @@ import ( "time" "github.com/dsoprea/go-exif/v2" - "github.com/dsoprea/go-exif/v2/common" - "github.com/dsoprea/go-jpeg-image-structure" - "github.com/dsoprea/go-png-image-structure" "gopkg.in/ugjka/go-tz.v2/tz" ) diff --git a/internal/meta/xmp_document.go b/internal/meta/xmp_document.go index a2a8a2820..98e67c5cd 100644 --- a/internal/meta/xmp_document.go +++ b/internal/meta/xmp_document.go @@ -192,8 +192,7 @@ type XmpDocument struct { } `xml:"RDF" json:"rdf,omitempty"` } - -func(doc *XmpDocument) Load(filename string) error { +func (doc *XmpDocument) Load(filename string) error { data, err := ioutil.ReadFile(filename) if err != nil { diff --git a/pkg/pluscode/pluscode_test.go b/pkg/pluscode/pluscode_test.go index 99de64bd7..807a183c2 100644 --- a/pkg/pluscode/pluscode_test.go +++ b/pkg/pluscode/pluscode_test.go @@ -28,7 +28,6 @@ func TestEncode(t *testing.T) { }) } - func TestEncodeLength(t *testing.T) { t.Run("germany_9", func(t *testing.T) { plusCode, err := EncodeLength(48.56344833333333, 8.996878333333333, 9) @@ -83,7 +82,7 @@ func TestEncodeLength(t *testing.T) { }) t.Run("lng_overflow", func(t *testing.T) { - plusCode, err := EncodeLength(48.56344833333333, 258.996878333333333,7) + plusCode, err := EncodeLength(48.56344833333333, 258.996878333333333, 7) if err == nil { t.Fatal("encode should return error") } @@ -98,4 +97,3 @@ func TestS2(t *testing.T) { assert.Equal(t, "4799e3772d14", token) }) } - diff --git a/pkg/s2/s2_test.go b/pkg/s2/s2_test.go index ddfd31d33..d7c16157c 100644 --- a/pkg/s2/s2_test.go +++ b/pkg/s2/s2_test.go @@ -152,5 +152,3 @@ func TestRange(t *testing.T) { assert.Equal(t, "", max) }) } - -