Code clean-up (make fmt)

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-01-15 19:59:25 +01:00
parent a4014ba560
commit 09bac902d0
9 changed files with 27 additions and 41 deletions

View file

@ -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
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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
}

View file

@ -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"
)

View file

@ -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 {

View file

@ -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)
})
}

View file

@ -152,5 +152,3 @@ func TestRange(t *testing.T) {
assert.Equal(t, "", max)
})
}