Update linter config and apply suggestions
- remove copyright years (they are in git) - remove outdated linter bug workarounds - update .golangci.yml to match current schema (as of golangci-lint 1.59.0)
This commit is contained in:
parent
3d16034c44
commit
11582d3590
26 changed files with 41 additions and 38 deletions
|
@ -1,7 +1,9 @@
|
|||
---
|
||||
run:
|
||||
go: "1.17"
|
||||
skip-files:
|
||||
go: "1.19"
|
||||
|
||||
issues:
|
||||
exclude-files:
|
||||
- boardvoting/assets.go
|
||||
|
||||
output:
|
||||
|
@ -13,7 +15,7 @@ linters-settings:
|
|||
const:
|
||||
ORGANIZATION: CAcert Inc.
|
||||
template: |-
|
||||
Copyright {{ YEAR-RANGE }} {{ ORGANIZATION }}
|
||||
Copyright {{ ORGANIZATION }}
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -27,8 +29,8 @@ linters-settings:
|
|||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
gomnd:
|
||||
ignore-functions:
|
||||
mnd:
|
||||
ignored-functions:
|
||||
- 'strconv.*'
|
||||
ignored-numbers:
|
||||
- '-1,0,1,2,8'
|
||||
|
@ -57,7 +59,7 @@ linters:
|
|||
- gofmt
|
||||
- goheader
|
||||
- goimports
|
||||
- gomnd
|
||||
- mnd
|
||||
- gosec
|
||||
- lll
|
||||
- makezero
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -62,7 +62,7 @@ func Test_secureHeaders(t *testing.T) {
|
|||
|
||||
SecureHeaders(next).ServeHTTP(rr, r)
|
||||
|
||||
rs := rr.Result() //nolint:bodyclose // linters bug
|
||||
rs := rr.Result()
|
||||
|
||||
defer func() { _ = rs.Body.Close() }()
|
||||
|
||||
|
@ -119,7 +119,7 @@ func TestApplication_tryAuthenticate(t *testing.T) {
|
|||
|
||||
mw.TryAuthenticate(next).ServeHTTP(rr, r)
|
||||
|
||||
rs := rr.Result() //nolint:bodyclose // linters bug
|
||||
rs := rr.Result()
|
||||
|
||||
defer func() { _ = rs.Body.Close() }()
|
||||
|
||||
|
@ -137,7 +137,7 @@ func TestApplication_tryAuthenticate(t *testing.T) {
|
|||
|
||||
mw.TryAuthenticate(next).ServeHTTP(rr, r)
|
||||
|
||||
rs := rr.Result() //nolint:bodyclose // linters bug
|
||||
rs := rr.Result()
|
||||
|
||||
defer func() { _ = rs.Body.Close() }()
|
||||
|
||||
|
@ -158,11 +158,12 @@ func TestApplication_tryAuthenticate(t *testing.T) {
|
|||
|
||||
mw.TryAuthenticate(next).ServeHTTP(rr, r)
|
||||
|
||||
rs := rr.Result() //nolint:bodyclose // linters bug
|
||||
rs := rr.Result()
|
||||
|
||||
defer func() { _ = rs.Body.Close() }()
|
||||
|
||||
assert.Equal(t, http.StatusOK, rs.StatusCode)
|
||||
|
||||
user := nextCtx.Value(ctxUser)
|
||||
|
||||
assert.NotNil(t, user)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2023 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2023 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -607,12 +607,12 @@ func (m *MotionModel) List(ctx context.Context, options *MotionListOptions) ([]*
|
|||
}
|
||||
|
||||
func (m *MotionModel) FillVoteSums(ctx context.Context, decisions []*Motion) error {
|
||||
decisionIds := make([]int64, len(decisions))
|
||||
decisionIDs := make([]int64, len(decisions))
|
||||
decisionMap := make(map[int64]*Motion, len(decisions))
|
||||
|
||||
for idx, decision := range decisions {
|
||||
decision.Sums = &VoteSums{}
|
||||
decisionIds[idx] = decision.ID
|
||||
decisionIDs[idx] = decision.ID
|
||||
decisionMap[decision.ID] = decision
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ func (m *MotionModel) FillVoteSums(ctx context.Context, decisions []*Motion) err
|
|||
FROM votes v
|
||||
WHERE v.decision IN (?)
|
||||
GROUP BY v.decision, v.vote`,
|
||||
decisionIds,
|
||||
decisionIDs,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not create IN query: %w", err)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2017-2024 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2022 CAcert Inc.
|
||||
Copyright CAcert Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
Loading…
Reference in a new issue