Fix Formatting

This commit is contained in:
Evan Reichard 2021-01-18 16:24:28 -05:00
parent b05b1eb9b6
commit 3fd6e7b957
9 changed files with 37 additions and 38 deletions

View File

@ -45,8 +45,8 @@ func cmdServer(ctx *cli.Context) error {
server.StartServer()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
<-c
signal.Notify(c, os.Interrupt)
<-c
server.StopServer()
os.Exit(0)

View File

@ -12,9 +12,9 @@ import (
)
type Server struct {
API *api.API
Auth *auth.AuthManager
Config *config.Config
API *api.API
Auth *auth.AuthManager
Config *config.Config
Database *db.DBManager
httpServer *http.Server
}
@ -45,8 +45,8 @@ func (s *Server) StartServer() {
err := s.httpServer.ListenAndServe()
if err != nil {
log.Error("Error starting server ", err)
return
}
return
}
}()
}

View File

@ -8,7 +8,7 @@ import (
"encoding/json"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"github.com/lestrrat-go/jwx/jwt"
"github.com/lestrrat-go/jwx/jwt"
"reichard.io/imagini/internal/models"
)

View File

@ -1,22 +1,21 @@
package auth
import (
"errors"
"fmt"
"time"
"errors"
"encoding/json"
"gorm.io/gorm"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"gorm.io/gorm"
"reichard.io/imagini/internal/db"
"reichard.io/imagini/internal/config"
"reichard.io/imagini/internal/models"
"reichard.io/imagini/internal/session"
log "github.com/sirupsen/logrus"
"github.com/lestrrat-go/jwx/jwa"
"github.com/lestrrat-go/jwx/jwt"
"encoding/json"
"fmt"
"time"
"github.com/lestrrat-go/jwx/jwa"
"github.com/lestrrat-go/jwx/jwt"
"reichard.io/imagini/internal/db"
"reichard.io/imagini/internal/config"
"reichard.io/imagini/internal/models"
"reichard.io/imagini/internal/session"
)
type AuthManager struct {

View File

@ -1,15 +1,15 @@
package db
import (
"path"
"path"
"gorm.io/gorm"
// "gorm.io/gorm/logger"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
// "gorm.io/gorm/logger"
"gorm.io/driver/sqlite"
log "github.com/sirupsen/logrus"
"reichard.io/imagini/internal/config"
"reichard.io/imagini/internal/models"
"reichard.io/imagini/internal/config"
"reichard.io/imagini/internal/models"
)
type DBManager struct {

View File

@ -4,7 +4,7 @@ import (
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
"reichard.io/imagini/internal/models"
"reichard.io/imagini/internal/models"
)
func (dbm *DBManager) CreateDevice(device models.Device) (models.Device, error) {

View File

@ -4,7 +4,7 @@ import (
"golang.org/x/crypto/bcrypt"
log "github.com/sirupsen/logrus"
"reichard.io/imagini/internal/models"
"reichard.io/imagini/internal/models"
)
func (dbm *DBManager) CreateUser(user models.User) (models.User, error) {

View File

@ -1,17 +1,17 @@
package models
import (
"github.com/google/uuid"
"gorm.io/gorm"
"time"
"gorm.io/gorm"
"github.com/google/uuid"
)
// Base contains common columns for all tables.
type Base struct {
UUID uuid.UUID `gorm:"type:uuid;primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}
func (base *Base) BeforeCreate(tx *gorm.DB) (err error) {

View File

@ -31,8 +31,8 @@ func (sm *SessionManager) Delete(key string) {
sm.mutex.Lock()
defer sm.mutex.Unlock()
_, exists := sm.values[key]
if !exists {
return
}
delete(sm.values, key)
if !exists {
return
}
delete(sm.values, key)
}