From e4c71123ef91480d41284288bee38939cd17ae39 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 1 Sep 2023 08:39:12 +0200 Subject: [PATCH] fix: lint --- pkg/migration/20230831155832.go | 11 ++++++----- pkg/models/api_tokens.go | 4 ++-- pkg/models/api_tokens_rights.go | 4 ++-- pkg/modules/auth/auth.go | 3 ++- pkg/routes/api_routes.go | 5 +++-- pkg/utils/random.go | 9 +-------- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/pkg/migration/20230831155832.go b/pkg/migration/20230831155832.go index cda7ba1ced6..0eb616345bb 100644 --- a/pkg/migration/20230831155832.go +++ b/pkg/migration/20230831155832.go @@ -1,5 +1,5 @@ // 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 // it under the terms of the GNU Affero General Public Licensee as published by @@ -17,12 +17,13 @@ package migration import ( - "src.techknowlogick.com/xormigrate" "time" + + "src.techknowlogick.com/xormigrate" "xorm.io/xorm" ) -type api_tokens20230831155832 struct { +type apiTokens20230831155832 struct { ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"token"` Title string `xorm:"not null" json:"title"` TokenSalt string `xorm:"not null" json:"-"` @@ -35,7 +36,7 @@ type api_tokens20230831155832 struct { OwnerID int64 `xorm:"bigint not null" json:"-"` } -func (api_tokens20230831155832) TableName() string { +func (apiTokens20230831155832) TableName() string { return "api_tokens" } @@ -44,7 +45,7 @@ func init() { ID: "20230831155832", Description: "", Migrate: func(tx *xorm.Engine) error { - return tx.Sync2(api_tokens20230831155832{}) + return tx.Sync2(apiTokens20230831155832{}) }, Rollback: func(tx *xorm.Engine) error { return nil diff --git a/pkg/models/api_tokens.go b/pkg/models/api_tokens.go index 4a037aeba87..2794daa03df 100644 --- a/pkg/models/api_tokens.go +++ b/pkg/models/api_tokens.go @@ -1,5 +1,5 @@ // 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 // it under the terms of the GNU Affero General Public Licensee as published by @@ -20,13 +20,13 @@ import ( "crypto/sha256" "crypto/subtle" "encoding/hex" - "golang.org/x/crypto/pbkdf2" "time" "code.vikunja.io/api/pkg/db" "code.vikunja.io/api/pkg/utils" "code.vikunja.io/web" + "golang.org/x/crypto/pbkdf2" "xorm.io/xorm" ) diff --git a/pkg/models/api_tokens_rights.go b/pkg/models/api_tokens_rights.go index 18aeab7c900..e687fd88b31 100644 --- a/pkg/models/api_tokens_rights.go +++ b/pkg/models/api_tokens_rights.go @@ -1,5 +1,5 @@ // 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 // 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 } -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 } diff --git a/pkg/modules/auth/auth.go b/pkg/modules/auth/auth.go index f61a8e99dd5..164ea51e0d9 100644 --- a/pkg/modules/auth/auth.go +++ b/pkg/modules/auth/auth.go @@ -17,11 +17,12 @@ package auth import ( - "code.vikunja.io/api/pkg/db" "fmt" "net/http" "time" + "code.vikunja.io/api/pkg/db" + "code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/models" "code.vikunja.io/api/pkg/user" diff --git a/pkg/routes/api_routes.go b/pkg/routes/api_routes.go index 85da44094c4..d25e68480bb 100644 --- a/pkg/routes/api_routes.go +++ b/pkg/routes/api_routes.go @@ -1,5 +1,5 @@ // 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 // it under the terms of the GNU Affero General Public Licensee as published by @@ -17,10 +17,11 @@ package routes import ( - "code.vikunja.io/api/pkg/models" "net/http" "strings" + "code.vikunja.io/api/pkg/models" + "github.com/labstack/echo/v4" ) diff --git a/pkg/utils/random.go b/pkg/utils/random.go index bed090df98c..e2304650b2a 100644 --- a/pkg/utils/random.go +++ b/pkg/utils/random.go @@ -1,5 +1,5 @@ // 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 // it under the terms of the GNU Affero General Public Licensee as published by @@ -23,13 +23,6 @@ import ( "math/big" ) -const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" -const ( - letterIdxBits = 6 // 6 bits to represent a letter index - letterIdxMask = 1<