update golangci-lint to version 1.51.1

The new version contains the ginkgolinter, which makes sure the
assertions are more helpful.

Also replace the deprecated os.SEEK_END with io.SeekEnd.

There is also a new `musttag` linter which checks if struct that are
un/marshalled all have json tags. This results in many warnings so I
disabled the check for now. We can reenable it if we think it is worth
it but for now it way to much work to fix all report problems.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
pull/17402/head
Paul Holzinger 2023-02-07 13:54:46 +01:00
parent 77ab826d02
commit 77e4b19397
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
4 changed files with 5 additions and 4 deletions

View File

@ -47,6 +47,7 @@ linters:
- lll
- gosec
- maligned
- musttag # way to many warnings to fix for now, also some false positives
- gomoddirectives
- containedctx
- contextcheck

View File

@ -929,7 +929,7 @@ install.tools: .install.golangci-lint ## Install needed tools
.PHONY: .install.golangci-lint
.install.golangci-lint:
VERSION=1.50.1 ./hack/install_golangci.sh
VERSION=1.51.1 ./hack/install_golangci.sh
.PHONY: .install.swagger
.install.swagger:

View File

@ -91,7 +91,7 @@ func (e EventLogFile) writeString(s string) error {
func (e EventLogFile) getTail(options ReadOptions) (*tail.Tail, error) {
reopen := true
seek := tail.SeekInfo{Offset: 0, Whence: os.SEEK_END}
seek := tail.SeekInfo{Offset: 0, Whence: io.SeekEnd}
if options.FromStart || !options.Stream {
seek.Whence = 0
reopen = false

View File

@ -1702,10 +1702,10 @@ func testHTTPServer(port string, shouldErr bool, expectedResponse string) {
time.Sleep(interval)
interval *= 2
}
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
body, err := io.ReadAll(resp.Body)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(string(body)).Should(Equal(expectedResponse))
}