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 to 1.23 #4080

Merged
merged 12 commits into from
Nov 13, 2024
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 .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21
1.23
33 changes: 13 additions & 20 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
run:
deadline: 5m
timeout: 5m
tests: false
skip-files:
- _gen\.go$
- _string\.go$
- mock_.*\.go$
- pkg/managerclient/sizesuffix.go
silent: true

linters-settings:
errcheck:
Expand All @@ -28,7 +22,6 @@ linters-settings:
- regexpSimplify
- yodaStyleExpr
- whyNoLint
- timeCmpSimplify
lll:
line-length: 180
nestif:
Expand All @@ -39,44 +32,42 @@ linters:
disable:
- depguard
- tagalign
- deadcode
- varcheck
- structcheck
- interfacebloat
- nosnakecase
- gci
- contextcheck
- cyclop
- durationcheck
- exhaustive
- exhaustivestruct
- exhaustruct
- forbidigo
- forcetypeassert
- funlen
- gas
- gosec
- gochecknoglobals
- gochecknoinits
- goerr113
- golint
- err113
- gomnd
- ifshort
- interfacer
- ireturn
- maligned
- nilerr
- nlreturn
- nolintlint
- nonamedreturns
- prealloc
- promlinter
- scopelint
- tagliatelle
- varnamelen
- wrapcheck
- wsl
- exportloopref
- execinquery
- mnd

issues:
exclude-files:
- _gen\.go$
- _string\.go$
- mock_.*\.go$
- pkg/managerclient/sizesuffix.go
exclude-use-default: false
exclude:
- a blank import should be only in a main or test package, or have a comment justifying it
Expand Down Expand Up @@ -125,5 +116,7 @@ issues:
- string `string` has [\d]+ occurrences, make it a constant
- Function name[:] .+, Cyclomatic Complexity
exclude-rules:
- path: v3/pkg/managerclient|pkg/command|pkg/cmd
text: Error return value of `fmt.Fprintf?(ln)?` is not checked
- path: pkg/scheduler/activation\.go
text: receiver-naming[:] receiver name .+ should be consistent with previous receiver name .+ for invalid-type
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/scylladb/scylla-manager/v3

go 1.21.1
go 1.23.2

require (
github.com/aws/aws-sdk-go v1.35.17
Expand Down
2 changes: 1 addition & 1 deletion install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rm -f "${LOCAL_BIN}"/*
echo "==> Installing Go packages at ${LOCAL_BIN}"

export GOBIN=${LOCAL_BIN}
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0
go install github.com/goreleaser/[email protected]
go install github.com/go-enry/go-license-detector/v4/cmd/license-detector@latest
go install github.com/golang/mock/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func newAgentHandler(c agent.Config, rclone http.Handler, logger log.Logger) *ch
}
})
m.Post("/terminate", selfSigterm())
m.Post("/free_os_memory", func(writer http.ResponseWriter, request *http.Request) {
m.Post("/free_os_memory", func(_ http.ResponseWriter, _ *http.Request) {
debug.FreeOSMemory()
})

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/agent/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var benchmarkArgs = struct {
var benchmarkCmd = &cobra.Command{
Use: "benchmark",
Short: "Executes benchmark scenarios, copies all files in each scenario directory to the location",
RunE: func(cmd *cobra.Command, args []string) (err error) {
RunE: func(cmd *cobra.Command, _ []string) (err error) {
ctx := context.Background()
defer func() {
if err != nil {
Expand Down Expand Up @@ -172,7 +172,7 @@ var defaultScenario = []struct {
var createScenarioCmd = &cobra.Command{
Use: "create-scenario",
Short: "Adds files of specified size to a scenario directory",
RunE: func(cmd *cobra.Command, args []string) (err error) {
RunE: func(cmd *cobra.Command, _ []string) (err error) {
defer func() {
if err != nil {
fmt.Fprintf(cmd.ErrOrStderr(), "FAILED: %v\n", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/agent/check_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var checkLocationArgs = struct {
var checkLocationCmd = &cobra.Command{
Use: "check-location",
Short: "Checks if backup location is accessible",
RunE: func(cmd *cobra.Command, args []string) (err error) {
RunE: func(cmd *cobra.Command, _ []string) (err error) {
defer func() {
if err != nil {
fmt.Fprintf(cmd.ErrOrStderr(), "FAILED: %v\n", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/agent/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var cpuTestCmd = &cobra.Command{
SilenceErrors: true,
Hidden: true,

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
cpus := cpuTestArgs.cpus
if len(cpus) == 0 {
fmt.Println("Running on all CPUs", "pid", os.Getpid())
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/agent/download_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var downloadFilesArgs = struct {
var downloadFilesCmd = &cobra.Command{
Use: "download-files",
Short: "Downloads files from backup location",
RunE: func(cmd *cobra.Command, args []string) (err error) {
RunE: func(cmd *cobra.Command, _ []string) (err error) {
a := downloadFilesArgs

// Validate action flags
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/agent/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package main

import (
"fmt"
"strconv"

"github.com/prometheus/client_golang/prometheus"
)
Expand Down Expand Up @@ -31,5 +31,5 @@ func (m AgentMetrics) MustRegister() AgentMetrics {

// RecordStatusCode increases counter of "status_code" metric.
func (m AgentMetrics) RecordStatusCode(method, path string, status int) {
m.StatusCode.WithLabelValues(method, path, fmt.Sprint(status)).Inc()
m.StatusCode.WithLabelValues(method, path, strconv.Itoa(status)).Inc()
}
2 changes: 1 addition & 1 deletion pkg/cmd/agent/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var rootCmd = &cobra.Command{
SilenceUsage: true,
SilenceErrors: true,

RunE: func(cmd *cobra.Command, args []string) (runError error) {
RunE: func(cmd *cobra.Command, _ []string) (runError error) {
// Print version and return
if rootArgs.version {
fmt.Fprintf(cmd.OutOrStdout(), "%s\n", pkg.Version())
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/sctool/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func addCompletionCommand(rootCmd *cobra.Command) {
cmd.AddCommand(&cobra.Command{
Use: string(s),
Short: "Generate " + string(s) + "completion",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
return completion(rootCmd, s)
},
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/sctool/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func newRootCommand(client *managerclient.Client) *cobra.Command {
client: client,
}
cmd.init()
cmd.PersistentPreRunE = func(_ *cobra.Command, args []string) error {
cmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error {
return cmd.preRun()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/scylla-manager/check_for_updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var checkForUpdatesCmd = &cobra.Command{
Short: "Check for updates",
Args: cobra.NoArgs,

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
install, err := cmd.Flags().GetBool("install")
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/scylla-manager/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var rootCmd = &cobra.Command{
SilenceUsage: true,
SilenceErrors: true,

RunE: func(cmd *cobra.Command, args []string) (runError error) {
RunE: func(cmd *cobra.Command, _ []string) (runError error) {
// Print version and return
if rootArgs.version {
fmt.Fprintf(cmd.OutOrStdout(), "%s\n", pkg.Version())
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/backup/backupdelete/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/backup/backupfiles/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/backup/backuplist/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/cluster/clusteradd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/cluster/clusterdelete/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/cluster/clusterlist/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
if err := yaml.Unmarshal(res, &cmd.Command); err != nil {
panic(err)
}
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/cluster/clusterupdate/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/legacy/task/tasklist/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/repair/repaircontrol/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/resume/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/status/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/tasks/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
panic(err)
}
cmd.init()
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/version/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewCommand(client *managerclient.Client) *cobra.Command {
if err := yaml.Unmarshal(res, &cmd.Command); err != nil {
panic(err)
}
cmd.RunE = func(_ *cobra.Command, args []string) error {
cmd.RunE = func(_ *cobra.Command, _ []string) error {
return cmd.run()
}
return &cmd.Command
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/agent/enrich.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ package agent

import (
"context"
"fmt"
"net"
"strconv"

"github.com/scylladb/scylla-manager/v3/pkg/scyllaclient"
)
Expand All @@ -19,7 +19,7 @@ func EnrichConfigFromAPI(ctx context.Context, addr string, c *Config) error {
c.Scylla = scyllaConfig

if c.HTTPS == "" {
c.HTTPS = net.JoinHostPort(c.Scylla.ListenAddress, fmt.Sprint(c.HTTPSPort))
c.HTTPS = net.JoinHostPort(c.Scylla.ListenAddress, strconv.Itoa(c.HTTPSPort))
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/downloader/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
package downloader

import (
"fmt"
"os"
"os/user"
"strconv"
"syscall"

"github.com/pkg/errors"
Expand All @@ -21,5 +21,5 @@ func dirOwner(dir string) (*user.User, error) {
return nil, errors.Errorf("unexpected OS stat typ %T", s.Sys())
}

return user.LookupId(fmt.Sprint(sys.Uid))
return user.LookupId(strconv.FormatUint(uint64(sys.Uid), 10))
}
4 changes: 2 additions & 2 deletions pkg/metrics/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func DeleteMatching(c CollectorDeleter, matcher func(*dto.Metric) bool) {
continue
}
if matcher(&data) {
toDelete = append(toDelete, makeLabels(data.Label))
toDelete = append(toDelete, makeLabels(data.GetLabel()))
}
}

Expand All @@ -47,7 +47,7 @@ func setGaugeVecMatching(c *prometheus.GaugeVec, value float64, matcher func(*dt
continue
}
if matcher(&data) {
labels = append(labels, makeLabels(data.Label))
labels = append(labels, makeLabels(data.GetLabel()))
}
}

Expand Down
Loading
Loading