chore(deps): update golangci-lint
This commit is contained in:
parent
1d1295e065
commit
4e90c6bb78
|
|
@ -138,7 +138,7 @@ steps:
|
||||||
event: [ push, tag, pull_request ]
|
event: [ push, tag, pull_request ]
|
||||||
|
|
||||||
- name: api-lint
|
- name: api-lint
|
||||||
image: golangci/golangci-lint:v1.61.0
|
image: golangci/golangci-lint:v1.64.5
|
||||||
pull: always
|
pull: always
|
||||||
environment:
|
environment:
|
||||||
GOPROXY: 'https://goproxy.kolaente.de'
|
GOPROXY: 'https://goproxy.kolaente.de'
|
||||||
|
|
@ -1214,6 +1214,6 @@ steps:
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: signature
|
kind: signature
|
||||||
hmac: bf9f28a874dae9397c45062a2e1c8839ab9624b2cf265838577e1baad7fe3d03
|
hmac: 3aa9604902b5bf7b6eb0db09fdaf833b78215005e7371c686a7e0723755c84f4
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
|
||||||
|
|
@ -119,3 +119,9 @@ issues:
|
||||||
- text: 'G115: integer overflow conversion int -> uint64'
|
- text: 'G115: integer overflow conversion int -> uint64'
|
||||||
linters:
|
linters:
|
||||||
- gosec
|
- gosec
|
||||||
|
- text: 'the methods of "Right" use pointer receiver and non-pointer receiver.'
|
||||||
|
linters:
|
||||||
|
- recvcheck
|
||||||
|
- text: 'the methods of "SubscriptionEntityType" use pointer receiver and non-pointer receiver.'
|
||||||
|
linters:
|
||||||
|
- recvcheck
|
||||||
|
|
|
||||||
|
|
@ -109,11 +109,11 @@ func initMysqlEngine() (engine *xorm.Engine, err error) {
|
||||||
}
|
}
|
||||||
engine.SetMaxOpenConns(config.DatabaseMaxOpenConnections.GetInt())
|
engine.SetMaxOpenConns(config.DatabaseMaxOpenConnections.GetInt())
|
||||||
engine.SetMaxIdleConns(config.DatabaseMaxIdleConnections.GetInt())
|
engine.SetMaxIdleConns(config.DatabaseMaxIdleConnections.GetInt())
|
||||||
max, err := time.ParseDuration(strconv.Itoa(config.DatabaseMaxConnectionLifetime.GetInt()) + `ms`)
|
maxLifetime, err := time.ParseDuration(strconv.Itoa(config.DatabaseMaxConnectionLifetime.GetInt()) + `ms`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
engine.SetConnMaxLifetime(max)
|
engine.SetConnMaxLifetime(maxLifetime)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,11 +168,11 @@ func initPostgresEngine() (engine *xorm.Engine, err error) {
|
||||||
engine.SetSchema(config.DatabaseSchema.GetString())
|
engine.SetSchema(config.DatabaseSchema.GetString())
|
||||||
engine.SetMaxOpenConns(config.DatabaseMaxOpenConnections.GetInt())
|
engine.SetMaxOpenConns(config.DatabaseMaxOpenConnections.GetInt())
|
||||||
engine.SetMaxIdleConns(config.DatabaseMaxIdleConnections.GetInt())
|
engine.SetMaxIdleConns(config.DatabaseMaxIdleConnections.GetInt())
|
||||||
max, err := time.ParseDuration(strconv.Itoa(config.DatabaseMaxConnectionLifetime.GetInt()) + `ms`)
|
maxLifetime, err := time.ParseDuration(strconv.Itoa(config.DatabaseMaxConnectionLifetime.GetInt()) + `ms`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
engine.SetConnMaxLifetime(max)
|
engine.SetConnMaxLifetime(maxLifetime)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1763,7 +1763,7 @@ func (err *ErrUnknownSubscriptionEntityType) Error() string {
|
||||||
const ErrCodeUnknownSubscriptionEntityType = 12001
|
const ErrCodeUnknownSubscriptionEntityType = 12001
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrUnknownSubscriptionEntityType) HTTPError() web.HTTPError {
|
func (err *ErrUnknownSubscriptionEntityType) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusPreconditionFailed,
|
HTTPCode: http.StatusPreconditionFailed,
|
||||||
Code: ErrCodeUnknownSubscriptionEntityType,
|
Code: ErrCodeUnknownSubscriptionEntityType,
|
||||||
|
|
@ -1792,7 +1792,7 @@ func (err *ErrSubscriptionAlreadyExists) Error() string {
|
||||||
const ErrCodeSubscriptionAlreadyExists = 12002
|
const ErrCodeSubscriptionAlreadyExists = 12002
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrSubscriptionAlreadyExists) HTTPError() web.HTTPError {
|
func (err *ErrSubscriptionAlreadyExists) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusPreconditionFailed,
|
HTTPCode: http.StatusPreconditionFailed,
|
||||||
Code: ErrCodeSubscriptionAlreadyExists,
|
Code: ErrCodeSubscriptionAlreadyExists,
|
||||||
|
|
@ -1818,7 +1818,7 @@ func (err *ErrMustProvideUser) Error() string {
|
||||||
const ErrCodeMustProvideUser = 12003
|
const ErrCodeMustProvideUser = 12003
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrMustProvideUser) HTTPError() web.HTTPError {
|
func (err *ErrMustProvideUser) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusPreconditionFailed,
|
HTTPCode: http.StatusPreconditionFailed,
|
||||||
Code: ErrCodeMustProvideUser,
|
Code: ErrCodeMustProvideUser,
|
||||||
|
|
@ -1849,7 +1849,7 @@ func (err *ErrLinkSharePasswordRequired) Error() string {
|
||||||
const ErrCodeLinkSharePasswordRequired = 13001
|
const ErrCodeLinkSharePasswordRequired = 13001
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrLinkSharePasswordRequired) HTTPError() web.HTTPError {
|
func (err *ErrLinkSharePasswordRequired) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusPreconditionFailed,
|
HTTPCode: http.StatusPreconditionFailed,
|
||||||
Code: ErrCodeLinkSharePasswordRequired,
|
Code: ErrCodeLinkSharePasswordRequired,
|
||||||
|
|
@ -1876,7 +1876,7 @@ func (err *ErrLinkSharePasswordInvalid) Error() string {
|
||||||
const ErrCodeLinkSharePasswordInvalid = 13002
|
const ErrCodeLinkSharePasswordInvalid = 13002
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrLinkSharePasswordInvalid) HTTPError() web.HTTPError {
|
func (err *ErrLinkSharePasswordInvalid) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusForbidden,
|
HTTPCode: http.StatusForbidden,
|
||||||
Code: ErrCodeLinkSharePasswordInvalid,
|
Code: ErrCodeLinkSharePasswordInvalid,
|
||||||
|
|
@ -1902,7 +1902,7 @@ func (err *ErrLinkShareTokenInvalid) Error() string {
|
||||||
const ErrCodeLinkShareTokenInvalid = 13003
|
const ErrCodeLinkShareTokenInvalid = 13003
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrLinkShareTokenInvalid) HTTPError() web.HTTPError {
|
func (err *ErrLinkShareTokenInvalid) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusBadRequest,
|
HTTPCode: http.StatusBadRequest,
|
||||||
Code: ErrCodeLinkShareTokenInvalid,
|
Code: ErrCodeLinkShareTokenInvalid,
|
||||||
|
|
@ -1932,7 +1932,7 @@ func (err *ErrAPITokenInvalid) Error() string {
|
||||||
const ErrCodeAPITokenInvalid = 14001
|
const ErrCodeAPITokenInvalid = 14001
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrAPITokenInvalid) HTTPError() web.HTTPError {
|
func (err *ErrAPITokenInvalid) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusBadRequest,
|
HTTPCode: http.StatusBadRequest,
|
||||||
Code: ErrCodeAPITokenInvalid,
|
Code: ErrCodeAPITokenInvalid,
|
||||||
|
|
@ -1960,7 +1960,7 @@ func (err *ErrInvalidAPITokenPermission) Error() string {
|
||||||
const ErrCodeInvalidAPITokenPermission = 14002
|
const ErrCodeInvalidAPITokenPermission = 14002
|
||||||
|
|
||||||
// HTTPError holds the http error description
|
// HTTPError holds the http error description
|
||||||
func (err ErrInvalidAPITokenPermission) HTTPError() web.HTTPError {
|
func (err *ErrInvalidAPITokenPermission) HTTPError() web.HTTPError {
|
||||||
return web.HTTPError{
|
return web.HTTPError{
|
||||||
HTTPCode: http.StatusBadRequest,
|
HTTPCode: http.StatusBadRequest,
|
||||||
Code: ErrCodeInvalidAPITokenPermission,
|
Code: ErrCodeInvalidAPITokenPermission,
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ type LinkSharing struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName holds the table name
|
// TableName holds the table name
|
||||||
func (LinkSharing) TableName() string {
|
func (*LinkSharing) TableName() string {
|
||||||
return "link_shares"
|
return "link_shares"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ type TeamProject struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName makes beautiful table names
|
// TableName makes beautiful table names
|
||||||
func (TeamProject) TableName() string {
|
func (*TeamProject) TableName() string {
|
||||||
return "team_projects"
|
return "team_projects"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ func (tl *TeamProject) Delete(s *xorm.Session, _ web.Auth) (err error) {
|
||||||
// Delete the relation
|
// Delete the relation
|
||||||
_, err = s.Where("team_id = ?", tl.TeamID).
|
_, err = s.Where("team_id = ?", tl.TeamID).
|
||||||
And("project_id = ?", tl.ProjectID).
|
And("project_id = ?", tl.ProjectID).
|
||||||
Delete(TeamProject{})
|
Delete(&TeamProject{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ type ProjectUser struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName is the table name for ProjectUser
|
// TableName is the table name for ProjectUser
|
||||||
func (ProjectUser) TableName() string {
|
func (*ProjectUser) TableName() string {
|
||||||
return "users_projects"
|
return "users_projects"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,9 +216,9 @@ func TestSavedFilter_Rights(t *testing.T) {
|
||||||
ID: 1,
|
ID: 1,
|
||||||
Title: "Lorem",
|
Title: "Lorem",
|
||||||
}
|
}
|
||||||
can, max, err := sf.CanRead(s, user1)
|
can, maxRight, err := sf.CanRead(s, user1)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, int(RightAdmin), max)
|
assert.Equal(t, int(RightAdmin), maxRight)
|
||||||
assert.True(t, can)
|
assert.True(t, can)
|
||||||
})
|
})
|
||||||
t.Run("not owner", func(t *testing.T) {
|
t.Run("not owner", func(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ type TaskAssginee struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName makes a pretty table name
|
// TableName makes a pretty table name
|
||||||
func (TaskAssginee) TableName() string {
|
func (*TaskAssginee) TableName() string {
|
||||||
return "task_assignees"
|
return "task_assignees"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ func (t *Task) updateTaskAssignees(s *xorm.Session, assignees []*user.User, doer
|
||||||
// If we don't have any new assignees, delete everything right away. Saves us some hassle.
|
// If we don't have any new assignees, delete everything right away. Saves us some hassle.
|
||||||
if len(assignees) == 0 && len(t.Assignees) > 0 {
|
if len(assignees) == 0 && len(t.Assignees) > 0 {
|
||||||
_, err = s.Where("task_id = ?", t.ID).
|
_, err = s.Where("task_id = ?", t.ID).
|
||||||
Delete(TaskAssginee{})
|
Delete(&TaskAssginee{})
|
||||||
t.setTaskAssignees(assignees)
|
t.setTaskAssignees(assignees)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +115,7 @@ func (t *Task) updateTaskAssignees(s *xorm.Session, assignees []*user.User, doer
|
||||||
if len(assigneesToDelete) > 0 {
|
if len(assigneesToDelete) > 0 {
|
||||||
_, err = s.In("user_id", assigneesToDelete).
|
_, err = s.In("user_id", assigneesToDelete).
|
||||||
And("task_id = ?", t.ID).
|
And("task_id = ?", t.ID).
|
||||||
Delete(TaskAssginee{})
|
Delete(&TaskAssginee{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ func (t *Task) addNewAssigneeByID(s *xorm.Session, newAssigneeID int64, project
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = s.Insert(TaskAssginee{
|
_, err = s.Insert(&TaskAssginee{
|
||||||
TaskID: t.ID,
|
TaskID: t.ID,
|
||||||
UserID: newAssigneeID,
|
UserID: newAssigneeID,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1606,7 +1606,7 @@ func (t *Task) Delete(s *xorm.Session, a web.Auth) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete assignees
|
// Delete assignees
|
||||||
if _, err = s.Where("task_id = ?", t.ID).Delete(TaskAssginee{}); err != nil {
|
if _, err = s.Where("task_id = ?", t.ID).Delete(&TaskAssginee{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ type Team struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName makes beautiful table names
|
// TableName makes beautiful table names
|
||||||
func (Team) TableName() string {
|
func (*Team) TableName() string {
|
||||||
return "teams"
|
return "teams"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue