Skip to content

Commit

Permalink
Merge pull request #107 from NETWAYS/chore/go1-23
Browse files Browse the repository at this point in the history
Bump to Go 1.23
  • Loading branch information
martialblog authored Sep 27, 2024
2 parents 07f1364 + 453152e commit 4bb9291
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.23

- name: Vet
run: go vet ./...
Expand All @@ -35,6 +35,6 @@ jobs:
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.54
version: v1.61
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ linters:
- goerr113
- gofumpt
- gomnd
- mnd
- lll
- musttag
- nakedret
Expand Down
4 changes: 2 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"fmt"
"errors"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -94,7 +94,7 @@ func (c *Config) NewClient() *client.Client {
if c.BasicAuth != "" {
s := strings.Split(c.BasicAuth, ":")
if len(s) != 2 {
check.ExitError(fmt.Errorf("specify the user name and password for server authentication <user:password>"))
check.ExitError(errors.New("specify the user name and password for server authentication <user:password>"))
}

var u = s[0]
Expand Down
5 changes: 3 additions & 2 deletions cmd/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
Expand Down Expand Up @@ -139,7 +140,7 @@ var healthCmd = &cobra.Command{
\_[OK] Heap usage at 12.00%
\_[OK] Open file descriptors at 12.00%
\_[WARNING] CPU usage at 55.00%`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
var (
output string
rc int
Expand Down Expand Up @@ -192,7 +193,7 @@ var healthCmd = &cobra.Command{
// Logstash Health Status
switch stat.Status {
default:
check.ExitError(fmt.Errorf("could not determine status"))
check.ExitError(errors.New("could not determine status"))
case "green":
states = append(states, check.OK)
case "yellow":
Expand Down
10 changes: 5 additions & 5 deletions cmd/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var pipelineCmd = &cobra.Command{
$ check_logstash pipeline --inflight-events-warn 5 --inflight-events-crit 10 --pipeline example
CRITICAL - Inflight events
\_[CRITICAL] inflight_events_example:15`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
var (
output string
rc int
Expand Down Expand Up @@ -143,7 +143,7 @@ var pipelineCmd = &cobra.Command{
Uom: "c",
Value: pipe.Events.Out})
perfList.Add(&perfdata.Perfdata{
Label: fmt.Sprintf("inflight_events_%s", name),
Label: fmt.Sprintf("inflight_events_%s", name), //nolint: perfsprint
Warn: thresholds.Warning,
Crit: thresholds.Critical,
Value: inflightEvents})
Expand Down Expand Up @@ -187,7 +187,7 @@ var pipelineReloadCmd = &cobra.Command{
$ check_logstash pipeline reload --pipeline Example
CRITICAL - Configuration reload failed
\_[CRITICAL] Configuration reload for pipeline Example failed on 2021-01-01T02:07:14Z`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
var (
output string
rc int
Expand Down Expand Up @@ -278,7 +278,7 @@ var pipelineFlowCmd = &cobra.Command{
$ check_logstash pipeline flow --pipeline example --warning 5 --critical 10
CRITICAL - Flow metrics not alright
\_[CRITICAL] queue_backpressure_example:11.23;`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
var (
output string
rc int
Expand Down Expand Up @@ -335,7 +335,7 @@ var pipelineFlowCmd = &cobra.Command{

// Generate perfdata for each event
perfList.Add(&perfdata.Perfdata{
Label: fmt.Sprintf("pipelines.queue_backpressure_%s", name),
Label: fmt.Sprintf("pipelines.queue_backpressure_%s", name), //nolint: perfsprint
Warn: thresholds.Warning,
Crit: thresholds.Critical,
Value: pipe.Flow.QueueBackpressure.Current})
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var Timeout = 30
var rootCmd = &cobra.Command{
Use: "check_logstash",
Short: "An Icinga check plugin to check Logstash",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
PersistentPreRun: func(_ *cobra.Command, _ []string) {
go check.HandleTimeout(Timeout)
},
Run: Usage,
Expand Down
4 changes: 2 additions & 2 deletions internal/logstash/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package logstash

import (
"encoding/json"
"fmt"
"errors"
"strconv"
"strings"
)
Expand Down Expand Up @@ -95,7 +95,7 @@ func (s *Stat) UnmarshalJSON(b []byte) error {
majorVersion, convErr := strconv.Atoi(v[0])

if convErr != nil {
return fmt.Errorf("could not determine version")
return errors.New("could not determine version")
}

s.MajorVersion = majorVersion
Expand Down

0 comments on commit 4bb9291

Please sign in to comment.