fix: lint

This commit is contained in:
kolaente 2023-09-01 08:39:12 +02:00
parent 5c6c6cd9f0
commit e4c71123ef
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
6 changed files with 16 additions and 20 deletions

View File

@ -1,5 +1,5 @@
// Vikunja is a to-do list application to facilitate your life. // Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-2021 Vikunja and contributors. All rights reserved. // Copyright 2018-present Vikunja and contributors. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public Licensee as published by // it under the terms of the GNU Affero General Public Licensee as published by
@ -17,12 +17,13 @@
package migration package migration
import ( import (
"src.techknowlogick.com/xormigrate"
"time" "time"
"src.techknowlogick.com/xormigrate"
"xorm.io/xorm" "xorm.io/xorm"
) )
type api_tokens20230831155832 struct { type apiTokens20230831155832 struct {
ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"token"` ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"token"`
Title string `xorm:"not null" json:"title"` Title string `xorm:"not null" json:"title"`
TokenSalt string `xorm:"not null" json:"-"` TokenSalt string `xorm:"not null" json:"-"`
@ -35,7 +36,7 @@ type api_tokens20230831155832 struct {
OwnerID int64 `xorm:"bigint not null" json:"-"` OwnerID int64 `xorm:"bigint not null" json:"-"`
} }
func (api_tokens20230831155832) TableName() string { func (apiTokens20230831155832) TableName() string {
return "api_tokens" return "api_tokens"
} }
@ -44,7 +45,7 @@ func init() {
ID: "20230831155832", ID: "20230831155832",
Description: "", Description: "",
Migrate: func(tx *xorm.Engine) error { Migrate: func(tx *xorm.Engine) error {
return tx.Sync2(api_tokens20230831155832{}) return tx.Sync2(apiTokens20230831155832{})
}, },
Rollback: func(tx *xorm.Engine) error { Rollback: func(tx *xorm.Engine) error {
return nil return nil

View File

@ -1,5 +1,5 @@
// Vikunja is a to-do list application to facilitate your life. // Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-2023 Vikunja and contributors. All rights reserved. // Copyright 2018-present Vikunja and contributors. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public Licensee as published by // it under the terms of the GNU Affero General Public Licensee as published by
@ -20,13 +20,13 @@ import (
"crypto/sha256" "crypto/sha256"
"crypto/subtle" "crypto/subtle"
"encoding/hex" "encoding/hex"
"golang.org/x/crypto/pbkdf2"
"time" "time"
"code.vikunja.io/api/pkg/db" "code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/utils" "code.vikunja.io/api/pkg/utils"
"code.vikunja.io/web" "code.vikunja.io/web"
"golang.org/x/crypto/pbkdf2"
"xorm.io/xorm" "xorm.io/xorm"
) )

View File

@ -1,5 +1,5 @@
// Vikunja is a to-do list application to facilitate your life. // Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-2023 Vikunja and contributors. All rights reserved. // Copyright 2018-present Vikunja and contributors. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public Licensee as published by // it under the terms of the GNU Affero General Public Licensee as published by
@ -35,6 +35,6 @@ func (t *APIToken) CanDelete(s *xorm.Session, a web.Auth) (bool, error) {
return true, nil return true, nil
} }
func (t *APIToken) CanCreate(s *xorm.Session, a web.Auth) (bool, error) { func (t *APIToken) CanCreate(_ *xorm.Session, _ web.Auth) (bool, error) {
return true, nil return true, nil
} }

View File

@ -17,11 +17,12 @@
package auth package auth
import ( import (
"code.vikunja.io/api/pkg/db"
"fmt" "fmt"
"net/http" "net/http"
"time" "time"
"code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/config"
"code.vikunja.io/api/pkg/models" "code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/user" "code.vikunja.io/api/pkg/user"

View File

@ -1,5 +1,5 @@
// Vikunja is a to-do list application to facilitate your life. // Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-2023 Vikunja and contributors. All rights reserved. // Copyright 2018-present Vikunja and contributors. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public Licensee as published by // it under the terms of the GNU Affero General Public Licensee as published by
@ -17,10 +17,11 @@
package routes package routes
import ( import (
"code.vikunja.io/api/pkg/models"
"net/http" "net/http"
"strings" "strings"
"code.vikunja.io/api/pkg/models"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )

View File

@ -1,5 +1,5 @@
// Vikunja is a to-do list application to facilitate your life. // Vikunja is a to-do list application to facilitate your life.
// Copyright 2018-2021 Vikunja and contributors. All rights reserved. // Copyright 2018-present Vikunja and contributors. All rights reserved.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public Licensee as published by // it under the terms of the GNU Affero General Public Licensee as published by
@ -23,13 +23,6 @@ import (
"math/big" "math/big"
) )
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
const (
letterIdxBits = 6 // 6 bits to represent a letter index
letterIdxMask = 1<<letterIdxBits - 1 // All 1-bits, as many as letterIdxBits
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
)
// MakeRandomString return a random string // MakeRandomString return a random string
// Deprecated: use CryptoRandomString instead // Deprecated: use CryptoRandomString instead
func MakeRandomString(n int) string { func MakeRandomString(n int) string {