Skip to content

Commit

Permalink
Merge pull request #165 from mehdy/bump-versions
Browse files Browse the repository at this point in the history
build(deps): Bump go version to 1.22 and all dependencies
  • Loading branch information
mehdy authored May 1, 2024
2 parents 8b7e122 + 62ef132 commit 3428698
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 125 deletions.
85 changes: 44 additions & 41 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,72 @@ jobs:

strategy:
matrix:
go: ['1.20']
go: ['1.22']

steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
id: go
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Get dependencies
run: make dep
- name: Get dependencies
run: make dep

- name: Build
run: make build

- name: Build
run: make build

test:
name: Test
runs-on: ubuntu-latest

strategy:
matrix:
go: ['1.20']
go: ['1.22']

steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
id: go

- name: Get dependencies
run: make dep
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Check for unused
run: make unused
- name: Get dependencies
run: make dep

- name: Test
run: make test
- name: Check for unused
run: make unused

- name: Test
run: make test

lint:
name: Lint
runs-on: ubuntu-latest

strategy:
matrix:
go: ['1.20']
go: ['1.22']

steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Check lints
run: sudo make lint
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.57.2
args: --timeout 3m
skip-pkg-cache: true
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.20"
go-version: "1.22"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOVERSION=1.20
ARG GOVERSION=1.22

FROM golang:${GOVERSION}-alpine as builder

Expand All @@ -14,7 +14,7 @@ RUN make dep
ADD . .
RUN make build

FROM alpine:3.17
FROM alpine:3.19

COPY --from=builder /build/keepalived-exporter /bin/keepalived-exporter

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT_NAME := keepalived-exporter
PKG := "github.com/mehdy/$(PROJECT_NAME)"
LINTER = golangci-lint
LINTER_VERSION = 1.53.3
LINTER_VERSION = 1.57.2
CURRENT_LINTER_VERSION := $(shell golangci-lint version 2>/dev/null | awk '{ print $$4 }')

BUILD_TIME := $(shell LANG=en_US date +"%F_%T_%z")
Expand All @@ -28,7 +28,7 @@ ifneq ($(CURRENT_LINTER_VERSION), $(LINTER_VERSION))
endif

lint: lintdeps ## to lint the files
$(LINTER) run --config=.golangci-lint.yml ./...
$(LINTER) run --config=.golangci.yml ./...

build: ## Build the binary file
@go build -v -ldflags="$(LD_FLAGS)" $(PKG)/cmd/$(PROJECT_NAME)
Expand Down
13 changes: 9 additions & 4 deletions cmd/keepalived-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
"github.com/mehdy/keepalived-exporter/internal/types/container"
"github.com/mehdy/keepalived-exporter/internal/types/host"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/collectors/version"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/version"
common_version "github.com/prometheus/common/version"
"github.com/sirupsen/logrus"
)

Expand All @@ -29,15 +30,19 @@ func main() {

if *versionFlag {
logrus.WithFields(logrus.Fields{
"commit": version.Revision, "version": version.Version, "build_time": version.BuildDate,
"commit": common_version.Revision, "version": common_version.Version, "build_time": common_version.BuildDate,
}).Info("Keepalived Exporter")

return
}

var c collector.Collector
if *keepalivedContainerName != "" {
c = container.NewKeepalivedContainerCollectorHost(*keepalivedJSON, *keepalivedContainerName, *keepalivedContainerTmpDir)
c = container.NewKeepalivedContainerCollectorHost(
*keepalivedJSON,
*keepalivedContainerName,
*keepalivedContainerTmpDir,
)
} else {
c = host.NewKeepalivedHostCollectorHost(*keepalivedJSON, *keepalivedPID)
}
Expand All @@ -47,7 +52,7 @@ func main() {
prometheus.MustRegister(version.NewCollector("keepalived_exporter"))

http.Handle(*metricsPath, promhttp.Handler())
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
_, err := w.Write([]byte(`<html>
<head><title>Keepalived Exporter</title></head>
<body>
Expand Down
45 changes: 27 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
module github.com/mehdy/keepalived-exporter

go 1.20
go 1.22

require (
github.com/cenkalti/backoff/v4 v4.2.1
github.com/docker/docker v24.0.7+incompatible
github.com/cenkalti/backoff/v4 v4.3.0
github.com/docker/docker v26.1.1+incompatible
github.com/hashicorp/go-version v1.6.0
github.com/prometheus/client_golang v1.18.0
github.com/prometheus/common v0.45.0
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/common v0.53.0
github.com/sirupsen/logrus v1.9.3
)

require (
github.com/Microsoft/go-winio v0.4.15 // indirect
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gotest.tools/v3 v3.4.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0 // indirect
go.opentelemetry.io/otel/metric v1.26.0 // indirect
go.opentelemetry.io/otel/sdk v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gotest.tools/v3 v3.5.1 // indirect
)
Loading

0 comments on commit 3428698

Please sign in to comment.