fixed error when migrating nothing

This commit is contained in:
Timo Riegebauer 2025-04-23 11:25:55 +00:00
parent 1a5eb031e5
commit a39a9a007c
3 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,10 @@
default: build run
default: clean run
build:
@CGO_ENABLED=0 GOOS=linux go build -o build/server main.go
run: build
@./build/server
clean:
@rm -rf ./build

View File

@ -41,7 +41,11 @@ func (a *App) Start() {
log.Fatal(a.d.Start(listenAddr))
}
func (a *App) Migrate(dst ...interface{}) error {
func (a *App) Migrate(dst ...any) error {
if len(dst) == 0 {
return nil
}
db, err := a.d.DB()
if err != nil {
return err

View File

@ -48,7 +48,7 @@ func ValidateToken(tokenString string) (jwt.MapClaims, error) {
return nil, errors.New("JWT_SECRET is not set")
}
token, err := jwt.Parse(tokenString, func(t *jwt.Token) (interface{}, error) {
token, err := jwt.Parse(tokenString, func(t *jwt.Token) (any, error) {
if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, errors.New("unexpected signing method")
}