Using goimports for formatting imports #50
This commit is contained in:
parent
00f79b2d01
commit
6a2af16d1c
35 changed files with 83 additions and 47 deletions
2
Makefile
2
Makefile
|
@ -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 ./...
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/commands"
|
||||
"github.com/urfave/cli"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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(`
|
||||
|
|
|
@ -2,6 +2,7 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
|
|
@ -2,9 +2,10 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
"github.com/urfave/cli"
|
||||
"log"
|
||||
)
|
||||
|
||||
var ConvertCommand = cli.Command{
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -2,9 +2,10 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
"github.com/urfave/cli"
|
||||
"log"
|
||||
)
|
||||
|
||||
var ImportCommand = cli.Command{
|
||||
|
|
|
@ -2,9 +2,10 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
"github.com/urfave/cli"
|
||||
"log"
|
||||
)
|
||||
|
||||
var IndexCommand = cli.Command{
|
||||
|
|
|
@ -2,6 +2,7 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -2,9 +2,10 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
"github.com/urfave/cli"
|
||||
"log"
|
||||
)
|
||||
|
||||
var ThumbnailsCommand = cli.Command{
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"github.com/jinzhu/gorm"
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
type Photo struct {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/gosimple/slug"
|
||||
"github.com/jinzhu/gorm"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Tag struct {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMediaFile_GetColors(t *testing.T) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewConverter(t *testing.T) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMediaFile_GetExifData(t *testing.T) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewImporter(t *testing.T) {
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMediaFile_GetRelatedFiles(t *testing.T) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMediaFile_GetThumbnail(t *testing.T) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package photoprism
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetRandomInt(t *testing.T) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package server
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue