Skip to content

Commit

Permalink
update golang to 1.21, golangci/golangci-lint to v1.55.2 (#872)
Browse files Browse the repository at this point in the history
* update golang to 1.21, golangci/golangci-lint to v1.55.2

* SA1019: rand.Seed has been deprecated
  • Loading branch information
oliver006 authored Jan 31, 2024
1 parent 020bf3c commit 17d85ea
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
51 changes: 27 additions & 24 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ services:

steps:
- name: start
image: "golang:1.20"
image: golang:1.21
pull: if-not-exists
commands:
- sleep 20
- sleep 10
- 'echo "start"'
when:
event:
Expand Down Expand Up @@ -153,7 +153,7 @@ steps:
- start

- name: lint
image: golangci/golangci-lint:v1.42.1-alpine
image: golangci/golangci-lint:v1.55.2-alpine
pull: if-not-exists
commands:
- golangci-lint run --tests=false --exclude-use-default
Expand All @@ -167,7 +167,7 @@ steps:
- start

- name: tests
image: "golang:1.20"
image: golang:1.21
pull: if-not-exists
environment:
GO111MODULE: on
Expand All @@ -182,24 +182,25 @@ steps:
- push
- tag
depends_on:
- test-docker-build
- start


- name: mixins
image: golang:1.20
image: golang:1.21
pull: if-not-exists
commands:
- make mixin
when:
event:
- pull_request
- push
- tag
depends_on:
- start


- name: coverage-codecov
image: golang:1.20
image: golang:1.21
pull: if-not-exists
environment:
CODECOV_TOKEN:
Expand All @@ -212,12 +213,13 @@ steps:
event:
- pull_request
- push
- tag
depends_on:
- tests


- name: coverage-coveralls
image: "golang:1.20"
image: golang:1.21
pull: if-not-exists
environment:
GO111MODULE: on
Expand All @@ -234,8 +236,9 @@ steps:
depends_on:
- tests

# this is just a smoke test if building a few different arch/OS combinations succeeds
- name: build-some-amd64-binaries
image: "golang:1.20"
image: golang:1.21
pull: if-not-exists
environment:
GO111MODULE: on
Expand All @@ -246,13 +249,13 @@ steps:
event:
- pull_request
- push
- tag
depends_on:
- tests

- start

# this builds the binaries that get uploaded to GH for a release
# docker binaries are build in docker itself via multi-stage Docker files
- name: build-all-binaries
image: "golang:1.20"
image: golang:1.21
pull: if-not-exists
environment:
GO111MODULE: on
Expand All @@ -263,7 +266,7 @@ steps:
event:
- tag
depends_on:
- build-some-amd64-binaries
- tests


- name: release-docker-image-scratch
Expand All @@ -288,7 +291,7 @@ steps:
event:
- tag
depends_on:
- build-all-binaries
- tests


- name: release-docker-image-alpine-arm64
Expand All @@ -313,7 +316,7 @@ steps:
event:
- tag
depends_on:
- release-docker-image-scratch
- tests


- name: release-docker-image-alpine-arm
Expand All @@ -338,7 +341,7 @@ steps:
event:
- tag
depends_on:
- release-docker-image-alpine-arm64
- tests


- name: release-docker-image-alpine-amd64
Expand All @@ -363,7 +366,7 @@ steps:
event:
- tag
depends_on:
- release-docker-image-alpine-arm
- tests


- name: manifest-docker-latest
Expand Down Expand Up @@ -459,7 +462,7 @@ steps:
event:
- tag
depends_on:
- manifest-docker-tag
- tests


- name: release-quay-alpine-arm64
Expand All @@ -485,7 +488,7 @@ steps:
event:
- tag
depends_on:
- release-quay-scratch
- tests


- name: release-quay-alpine-arm
Expand All @@ -511,7 +514,7 @@ steps:
event:
- tag
depends_on:
- release-quay-alpine-arm64
- tests


- name: release-quay-alpine-amd64
Expand All @@ -537,7 +540,7 @@ steps:
event:
- tag
depends_on:
- release-quay-alpine-arm
- tests


- name: manifest-quay-latest
Expand Down Expand Up @@ -606,7 +609,7 @@ steps:


- name: release-github-binaries
image: "golang:1.20"
image: golang:1.21
pull: if-not-exists
environment:
GITHUB_TOKEN:
Expand All @@ -619,4 +622,4 @@ steps:
event:
- tag
depends_on:
- manifest-quay-tag
- build-all-binaries
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG GOARCH
#
# build container
#
FROM --platform=linux/amd64 golang:1.20-alpine as builder
FROM --platform=linux/amd64 golang:1.21-alpine as builder
WORKDIR /go/src/github.com/oliver006/redis_exporter/

ADD . /go/src/github.com/oliver006/redis_exporter/
Expand Down
8 changes: 4 additions & 4 deletions exporter/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ type ClientInfo struct {
}

/*
Valid Examples
id=11 addr=127.0.0.1:63508 fd=8 name= age=6321 idle=6320 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=setex user=default resp=2
id=14 addr=127.0.0.1:64958 fd=9 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 obl=0 oll=0 omem=0 events=r cmd=client user=default resp=3
id=40253233 addr=fd40:1481:21:dbe0:7021:300:a03:1a06:44426 fd=19 name= age=782 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 argv-mem=10 obl=0 oll=0 omem=0 tot-mem=61466 ow=0 owmem=0 events=r cmd=client user=default lib-name=redis-py lib-ver=5.0.1 numops=9
Valid Examples
id=11 addr=127.0.0.1:63508 fd=8 name= age=6321 idle=6320 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=setex user=default resp=2
id=14 addr=127.0.0.1:64958 fd=9 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 obl=0 oll=0 omem=0 events=r cmd=client user=default resp=3
id=40253233 addr=fd40:1481:21:dbe0:7021:300:a03:1a06:44426 fd=19 name= age=782 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 argv-mem=10 obl=0 oll=0 omem=0 tot-mem=61466 ow=0 owmem=0 events=r cmd=client user=default lib-name=redis-py lib-ver=5.0.1 numops=9
*/
func parseClientListString(clientInfo string) (*ClientInfo, bool) {
if matched, _ := regexp.MatchString(`^id=\d+ addr=\S+`, clientInfo); !matched {
Expand Down
3 changes: 0 additions & 3 deletions exporter/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package exporter

import (
"fmt"
"math/rand"
"net/http/httptest"
"os"
"strings"
Expand Down Expand Up @@ -380,8 +379,6 @@ func TestKeyDbMetrics(t *testing.T) {
}

func init() {
rand.Seed(time.Now().UnixNano())

ll := strings.ToLower(os.Getenv("LOG_LEVEL"))
if pl, err := log.ParseLevel(ll); err == nil {
log.Printf("Setting log level to: %s", ll)
Expand Down

0 comments on commit 17d85ea

Please sign in to comment.