Using goimports for formatting imports #50

This commit is contained in:
Michael Mayer 2018-10-31 07:14:33 +01:00
parent 00f79b2d01
commit 6a2af16d1c
35 changed files with 83 additions and 47 deletions

View file

@ -8,6 +8,7 @@ GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOFMT=$(GOCMD) fmt
GOIMPORTS=goimports
BINARY_NAME=photoprism
all: tensorflow-model dep js build
@ -44,6 +45,7 @@ tensorflow-model:
docker-push:
scripts/docker-push.sh
fmt:
$(GOIMPORTS) -w internal cmd
$(GOFMT) ./...
dep:
$(GOBUILD) -v ./...

View file

@ -1,9 +1,10 @@
package main
import (
"os"
"github.com/photoprism/photoprism/internal/commands"
"github.com/urfave/cli"
"os"
)
func main() {

View file

@ -1,13 +1,14 @@
package api
import (
"log"
"net/http"
"strconv"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/photoprism/photoprism/internal/forms"
"github.com/photoprism/photoprism/internal/photoprism"
"log"
"net/http"
"strconv"
)
// GetPhotos searches the databse for photos based on a form.

View file

@ -2,10 +2,11 @@ package api
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/photoprism"
"log"
"strconv"
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/photoprism"
)
var photoIconSvg = []byte(`

View file

@ -2,6 +2,7 @@ package commands
import (
"fmt"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/urfave/cli"
)

View file

@ -2,9 +2,10 @@ package commands
import (
"fmt"
"log"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/urfave/cli"
"log"
)
var ConvertCommand = cli.Command{

View file

@ -2,10 +2,11 @@ package commands
import (
"fmt"
"log"
"github.com/araddon/dateparse"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/urfave/cli"
"log"
)
var ExportCommand = cli.Command{

View file

@ -2,9 +2,10 @@ package commands
import (
"fmt"
"log"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/urfave/cli"
"log"
)
var ImportCommand = cli.Command{

View file

@ -2,9 +2,10 @@ package commands
import (
"fmt"
"log"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/urfave/cli"
"log"
)
var IndexCommand = cli.Command{

View file

@ -2,6 +2,7 @@ package commands
import (
"fmt"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/urfave/cli"
)

View file

@ -2,10 +2,11 @@ package commands
import (
"fmt"
"log"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/photoprism/photoprism/internal/server"
"github.com/urfave/cli"
"log"
)
var StartCommand = cli.Command{

View file

@ -2,9 +2,10 @@ package commands
import (
"fmt"
"log"
"github.com/photoprism/photoprism/internal/photoprism"
"github.com/urfave/cli"
"log"
)
var ThumbnailsCommand = cli.Command{

View file

@ -1,8 +1,9 @@
package models
import (
"github.com/jinzhu/gorm"
"time"
"github.com/jinzhu/gorm"
)
type Photo struct {

View file

@ -1,9 +1,10 @@
package models
import (
"strings"
"github.com/gosimple/slug"
"github.com/jinzhu/gorm"
"strings"
)
type Tag struct {

View file

@ -1,12 +1,13 @@
package photoprism
import (
"github.com/RobCherry/vibrant"
"github.com/lucasb-eyer/go-colorful"
"golang.org/x/image/colornames"
"image"
"os"
"sort"
"github.com/RobCherry/vibrant"
"github.com/lucasb-eyer/go-colorful"
"golang.org/x/image/colornames"
)
func getColorNames(actualColor colorful.Color) (result []string) {

View file

@ -1,8 +1,9 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMediaFile_GetColors(t *testing.T) {

View file

@ -1,6 +1,10 @@
package photoprism
import (
"log"
"os"
"time"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mssql"
_ "github.com/jinzhu/gorm/dialects/mysql"
@ -9,9 +13,6 @@ import (
"github.com/kylelemons/go-gypsy/yaml"
. "github.com/photoprism/photoprism/internal/models"
"github.com/urfave/cli"
"log"
"os"
"time"
)
type Config struct {

View file

@ -3,11 +3,12 @@ package photoprism
import (
"flag"
"fmt"
"os"
"testing"
"github.com/jinzhu/gorm"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
"os"
"testing"
)
const testDataPath = "testdata"

View file

@ -1,9 +1,10 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewConverter(t *testing.T) {

View file

@ -2,11 +2,12 @@ package photoprism
import (
"errors"
"github.com/rwcarlsen/goexif/exif"
"github.com/rwcarlsen/goexif/mknote"
"math"
"strings"
"time"
"github.com/rwcarlsen/goexif/exif"
"github.com/rwcarlsen/goexif/mknote"
)
type ExifData struct {

View file

@ -1,8 +1,9 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMediaFile_GetExifData(t *testing.T) {

View file

@ -1,8 +1,9 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewImporter(t *testing.T) {

View file

@ -2,13 +2,14 @@ package photoprism
import (
"fmt"
"github.com/jinzhu/gorm"
. "github.com/photoprism/photoprism/internal/models"
"log"
"os"
"path/filepath"
"strings"
"time"
"github.com/jinzhu/gorm"
. "github.com/photoprism/photoprism/internal/models"
)
const (

View file

@ -3,10 +3,6 @@ package photoprism
import (
"encoding/hex"
"fmt"
"github.com/brett-lempereur/ish"
"github.com/djherbis/times"
. "github.com/photoprism/photoprism/internal/models"
"github.com/steakknife/hamming"
"image"
_ "image/gif"
_ "image/jpeg"
@ -20,6 +16,11 @@ import (
"sort"
"strings"
"time"
"github.com/brett-lempereur/ish"
"github.com/djherbis/times"
. "github.com/photoprism/photoprism/internal/models"
"github.com/steakknife/hamming"
)
const (

View file

@ -1,8 +1,9 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMediaFile_GetRelatedFiles(t *testing.T) {

View file

@ -3,11 +3,12 @@ package photoprism
import (
"encoding/json"
"fmt"
. "github.com/photoprism/photoprism/internal/models"
"github.com/pkg/errors"
"net/http"
"strconv"
"strings"
. "github.com/photoprism/photoprism/internal/models"
"github.com/pkg/errors"
)
type OpenstreetmapAddress struct {

View file

@ -1,11 +1,12 @@
package photoprism
import (
"strings"
"time"
"github.com/jinzhu/gorm"
. "github.com/photoprism/photoprism/internal/forms"
. "github.com/photoprism/photoprism/internal/models"
"strings"
"time"
)
type Search struct {

View file

@ -1,8 +1,9 @@
package photoprism
import (
"github.com/photoprism/photoprism/internal/forms"
"testing"
"github.com/photoprism/photoprism/internal/forms"
)
func TestSearch_Photos_Query(t *testing.T) {

View file

@ -3,12 +3,13 @@ package photoprism
import (
"bufio"
"errors"
tf "github.com/tensorflow/tensorflow/tensorflow/go"
"github.com/tensorflow/tensorflow/tensorflow/go/op"
"io/ioutil"
"log"
"os"
"sort"
tf "github.com/tensorflow/tensorflow/tensorflow/go"
"github.com/tensorflow/tensorflow/tensorflow/go/op"
)
type TensorFlow struct {

View file

@ -1,9 +1,10 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"io/ioutil"
"testing"
"github.com/stretchr/testify/assert"
)
func TestTensorFlow_GetImageTags(t *testing.T) {

View file

@ -2,11 +2,12 @@ package photoprism
import (
"fmt"
"github.com/disintegration/imaging"
"log"
"os"
"path/filepath"
"strings"
"github.com/disintegration/imaging"
)
func CreateThumbnailsFromOriginals(originalsPath string, thumbnailsPath string, size int, square bool) {

View file

@ -1,8 +1,9 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMediaFile_GetThumbnail(t *testing.T) {

View file

@ -1,8 +1,9 @@
package photoprism
import (
"github.com/stretchr/testify/assert"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetRandomInt(t *testing.T) {

View file

@ -1,10 +1,11 @@
package server
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/api"
"github.com/photoprism/photoprism/internal/photoprism"
"net/http"
)
func registerRoutes(app *gin.Engine, conf *photoprism.Config) {

View file

@ -2,6 +2,7 @@ package server
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/photoprism"
)