Skip to content

Commit

Permalink
build(deps): bump golang from 1.22.5 to 1.23.0 (#1140)
Browse files Browse the repository at this point in the history
* build(deps): bump golang from 1.22.5 to 1.23.0

Bumps golang from 1.22.5 to 1.23.0.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update golangci-lint

* Remove depguard linter as we do not have that configured

* Remove deprecated megacheck linter

* Fix linting issues

* Fix more linting issues

* More linting fixes

* Fix more linting issues

* Update testcase for error message check

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Horst Gutmann <[email protected]>
  • Loading branch information
dependabot[bot] and zerok authored Sep 6, 2024
1 parent d69d2f2 commit 65594a1
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 36 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
linters:
enable:
- depguard
- dogsled
- errcheck
- exportloopref
- copyloopvar
- goconst
- gocritic
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- megacheck
- misspell
- revive
- staticcheck
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# download kubectl
FROM golang:1.22.5-alpine AS kubectl
FROM golang:1.23.0-alpine AS kubectl
RUN apk add --no-cache curl
RUN export VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) &&\
export OS=$(go env GOOS) && \
Expand All @@ -8,7 +8,7 @@ RUN export VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/r
chmod +x /usr/local/bin/kubectl

# build jsonnet-bundler
FROM golang:1.22.5-alpine AS jb
FROM golang:1.23.0-alpine AS jb
WORKDIR /tmp
RUN apk add --no-cache git make bash &&\
git clone https://github.com/jsonnet-bundler/jsonnet-bundler &&\
Expand All @@ -17,7 +17,7 @@ RUN apk add --no-cache git make bash &&\
make static &&\
mv _output/jb /usr/local/bin/jb

FROM golang:1.22.5-alpine AS helm
FROM golang:1.23.0-alpine AS helm
WORKDIR /tmp/helm
RUN apk add --no-cache jq curl
RUN export TAG=$(curl --silent "https://api.github.com/repos/helm/helm/releases/latest" | jq -r .tag_name) &&\
Expand All @@ -26,7 +26,7 @@ RUN export TAG=$(curl --silent "https://api.github.com/repos/helm/helm/releases/
curl -SL "https://get.helm.sh/helm-${TAG}-${OS}-${ARCH}.tar.gz" > helm.tgz && \
tar -xvf helm.tgz --strip-components=1

FROM golang:1.22.5-alpine AS kustomize
FROM golang:1.23.0-alpine AS kustomize
WORKDIR /tmp/kustomize
RUN apk add --no-cache jq curl
# Get the latest version of kustomize
Expand All @@ -39,7 +39,7 @@ RUN export TAG=$(curl --silent "https://api.github.com/repos/kubernetes-sigs/kus
curl -SL "https://github.com/kubernetes-sigs/kustomize/releases/download/${TAG}/kustomize_${VERSION_TAG}_${OS}_${ARCH}.tar.gz" > kustomize.tgz && \
tar -xvf kustomize.tgz

FROM golang:1.22.5 AS build
FROM golang:1.23.0 AS build
WORKDIR /app
COPY . .
RUN make static
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GOX := $(BIN_DIR)/gox
GOLINTER := $(GOPATH)/bin/golangci-lint

$(GOLINTER):
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3

lint: $(GOLINTER)
$(GOLINTER) run
Expand Down
4 changes: 2 additions & 2 deletions cmd/tk/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func envRemoveCmd() *cli.Command {
Aliases: []string{"rm"},
Short: "delete an environment",
Args: workflowArgs,
Run: func(cmd *cli.Command, args []string) error {
Run: func(_ *cli.Command, args []string) error {
for _, arg := range args {
path, err := filepath.Abs(arg)
if err != nil {
Expand Down Expand Up @@ -243,7 +243,7 @@ func envListCmd() *cli.Command {

getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
var path string
var err error
if len(args) == 1 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tk/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func exportCmd() *cli.Command {

recursive := cmd.Flags().BoolP("recursive", "r", false, "Look recursively for Tanka environments")

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
// Allocate a block of memory to alter GC behaviour. See https://github.com/golang/go/issues/23044
ballast := make([]byte, *ballastBytes)
defer runtime.KeepAlive(ballast)
Expand Down
4 changes: 2 additions & 2 deletions cmd/tk/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func fmtCmd() *cli.Command {
exclude := cmd.Flags().StringSliceP("exclude", "e", []string{"**/.*", ".*", "**/vendor/**", "vendor/**"}, "globs to exclude")
verbose := cmd.Flags().BoolP("verbose", "v", false, "print each checked file")

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
if len(args) == 1 && args[0] == ArgStdin {
return fmtStdin(*test)
}
Expand All @@ -47,7 +47,7 @@ func fmtCmd() *cli.Command {
var outFn tanka.OutFn
switch {
case *test:
outFn = func(name, content string) error { return nil }
outFn = func(_, _ string) error { return nil }
case *stdout:
outFn = func(name, content string) error {
fmt.Printf("// %s\n%s", name, content)
Expand Down
2 changes: 1 addition & 1 deletion cmd/tk/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func initCmd() *cli.Command {
installK8s := cmd.Flags().String("k8s", defaultK8sVersion, "choose the version of k8s-libsonnet, set to false to skip")
inline := cmd.Flags().BoolP("inline", "i", false, "create an inline environment")

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, _ []string) error {
failed := false

files, err := os.ReadDir(".")
Expand Down
2 changes: 1 addition & 1 deletion cmd/tk/jsonnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func evalCmd() *cli.Command {

getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
jsonnetOpts := tanka.Opts{
JsonnetImplementation: *jsonnetImplementation,
JsonnetOpts: getJsonnetOpts(),
Expand Down
2 changes: 1 addition & 1 deletion cmd/tk/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func lintCmd() *cli.Command {
panic(err)
}

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
globs := make([]glob.Glob, len(*exclude))
for i, e := range *exclude {
g, err := glob.Compile(e)
Expand Down
2 changes: 1 addition & 1 deletion cmd/tk/prefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func prefixCommands(prefix string) (cmds []*cli.Command) {
extCommand.Stdout = os.Stdout
extCommand.Stderr = os.Stderr

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
extCommand.Args = append(extCommand.Args, args...)
return extCommand.Run()
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/tk/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func statusCmd() *cli.Command {
vars := workflowFlags(cmd.Flags())
getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
status, err := tanka.Status(args[0], tanka.Opts{
JsonnetImplementation: vars.jsonnetImplementation,
JsonnetOpts: getJsonnetOpts(),
Expand Down
6 changes: 3 additions & 3 deletions cmd/tk/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func jpathCmd() *cli.Command {

debug := cmd.Flags().BoolP("debug", "d", false, "show debug info")

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
path := args[0]

entrypoint, err := jpath.Entrypoint(path)
Expand Down Expand Up @@ -81,7 +81,7 @@ func importsCmd() *cli.Command {

check := cmd.Flags().StringP("check", "c", "", "git commit hash to check against")

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
var modFiles []string
if *check != "" {
var err error
Expand Down Expand Up @@ -156,7 +156,7 @@ if the file is not a vendored (located at <tk-root>/vendor/) or a lib file (loca
}

root := cmd.Flags().String("root", ".", "root directory to search for environments")
cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
root, err := filepath.Abs(*root)
if err != nil {
return fmt.Errorf("resolving root: %w", err)
Expand Down
12 changes: 6 additions & 6 deletions cmd/tk/toolCharts.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func chartsVendorCmd() *cli.Command {
prune := cmd.Flags().Bool("prune", false, "also remove non-vendored files from the destination directory")
repoConfigPath := cmd.Flags().String("repository-config", "", repoConfigFlagUsage)

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, _ []string) error {
c, err := loadChartfile()
if err != nil {
return err
Expand All @@ -60,7 +60,7 @@ func chartsAddCmd() *cli.Command {
}
repoConfigPath := cmd.Flags().String("repository-config", "", repoConfigFlagUsage)

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
c, err := loadChartfile()
if err != nil {
return err
Expand All @@ -79,7 +79,7 @@ func chartsAddRepoCmd() *cli.Command {
Args: cli.ArgsExact(2),
}

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
c, err := loadChartfile()
if err != nil {
return err
Expand All @@ -100,7 +100,7 @@ func chartsConfigCmd() *cli.Command {
Short: "Displays the current manifest",
}

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, _ []string) error {
c, err := loadChartfile()
if err != nil {
return err
Expand All @@ -125,7 +125,7 @@ func chartsInitCmd() *cli.Command {
Short: "Create a new Chartfile",
}

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, _ []string) error {
wd, err := os.Getwd()
if err != nil {
return err
Expand Down Expand Up @@ -155,7 +155,7 @@ func chartsVersionCheckCmd() *cli.Command {
repoConfigPath := cmd.Flags().String("repository-config", "", repoConfigFlagUsage)
prettyPrint := cmd.Flags().Bool("pretty-print", false, "pretty print json output with indents")

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, _ []string) error {
c, err := loadChartfile()
if err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions cmd/tk/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func applyCmd() *cli.Command {
vars := workflowFlags(cmd.Flags())
getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
err := validateDryRun(opts.DryRun)
if err != nil {
return err
Expand Down Expand Up @@ -141,7 +141,7 @@ func pruneCmd() *cli.Command {
addDiffFlags(cmd.Flags(), &opts.DiffBaseOpts)
getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
err := validateDryRun(opts.DryRun)
if err != nil {
return err
Expand Down Expand Up @@ -182,7 +182,7 @@ func deleteCmd() *cli.Command {
vars := workflowFlags(cmd.Flags())
getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
err := validateDryRun(opts.DryRun)
if err != nil {
return err
Expand Down Expand Up @@ -229,7 +229,7 @@ func diffCmd() *cli.Command {
vars := workflowFlags(cmd.Flags())
getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
if err := setForceColor(&opts.DiffBaseOpts); err != nil {
return err
}
Expand Down Expand Up @@ -280,7 +280,7 @@ func showCmd() *cli.Command {
vars := workflowFlags(cmd.Flags())
getJsonnetOpts := jsonnetFlags(cmd.Flags())

cmd.Run = func(cmd *cli.Command, args []string) error {
cmd.Run = func(_ *cli.Command, args []string) error {
if !interactive && !*allowRedirect {
fmt.Fprintln(os.Stderr, `Redirection of the output of tk show is discouraged and disabled by default.
If you want to export .yaml files for use with other tools, try 'tk export'.
Expand Down
4 changes: 2 additions & 2 deletions pkg/helm/charts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestAdd(t *testing.T) {

// Adding a chart with a different version to the same path, causes a conflict
err = c.Add([]string{"stable/[email protected]"}, "")
assert.EqualError(t, err, `Validation errors:
assert.EqualError(t, err, `validation errors:
- output directory "prometheus" is used twice, by charts "stable/[email protected]" and "stable/[email protected]"`)

// Add a chart with a specific extract directory
Expand Down Expand Up @@ -241,7 +241,7 @@ func TestInvalidChartName(t *testing.T) {
})

err = c.Vendor(false, "")
assert.EqualError(t, err, `Validation errors:
assert.EqualError(t, err, `validation errors:
- Chart name "noslash" is not valid. Expecting a repo/name format.`)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/helm/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (r Requirements) Validate() error {
}

if len(errs) > 0 {
return fmt.Errorf("Validation errors:\n - " + strings.Join(errs, "\n - "))
return fmt.Errorf("validation errors:\n - %s", strings.Join(errs, "\n - "))
}

return nil
Expand Down

0 comments on commit 65594a1

Please sign in to comment.