Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Go Version in build and golangci #25

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .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: Test
run: go test -v ./...
Expand Down
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 @@ -22,6 +22,7 @@ linters:
- goerr113
- godox
- gomnd
- mnd
- nakedret
- musttag
- nlreturn
Expand Down
4 changes: 2 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"context"
"fmt"
"errors"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -72,7 +72,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
2 changes: 1 addition & 1 deletion cmd/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var healthCmd = &cobra.Command{
API translation:
pass = OK
fail = CRITICAL`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
// Creating an client and connecting to the API
c := cliConfig.NewClient()

Expand Down
9 changes: 5 additions & 4 deletions cmd/query.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"errors"
"fmt"
"net/http"
"os"
Expand Down Expand Up @@ -57,9 +58,9 @@ func convertToFloat64(value interface{}) (float64, error) {
case uint:
return float64(res), nil
case string:
return 0, fmt.Errorf("string value can not be evaluated")
return 0, errors.New("string value can not be evaluated")
default:
return 0, fmt.Errorf("unknown data type")
return 0, errors.New("unknown data type")
}
}

Expand Down Expand Up @@ -152,12 +153,12 @@ var queryCmd = &cobra.Command{
Use: "query",
Short: "Checks one specific or multiple values from the database using flux",
Long: `Checks one specific or multiple values from the database using flux`,
Run: func(cmd *cobra.Command, args []string) {
Run: func(_ *cobra.Command, _ []string) {
var fluxQuery string
var err error

if cliQueryConfig.FluxFile == "" && cliQueryConfig.FluxString == "" {
check.ExitError(fmt.Errorf("flux script needs to be defined with either --flux-file or --flux-string"))
check.ExitError(errors.New("flux script needs to be defined with either --flux-file or --flux-string"))
}

crit, err = check.ParseThreshold(cliQueryConfig.Critical)
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_influxdb",
Short: "An Icinga check plugin to check InfluxDB",
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/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package influxdb

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

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

v.MajorVersion = majorVersion
Expand Down
3 changes: 2 additions & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
Expand Down Expand Up @@ -47,7 +48,7 @@ func (c *Client) Version() (influxdb.APIVersion, error) {
// Do the HTTP Request to the URL.
resp, err := c.Client.Do(req)
if resp == nil {
return v, fmt.Errorf("could not reach influxdb instance")
return v, errors.New("could not reach influxdb instance")
}

if err != nil {
Expand Down