Skip to content

Commit 898f7f8

Browse files
committed
ran new go fix
1 parent 35493f9 commit 898f7f8

38 files changed

+118
-134
lines changed

defaults/tasks_renamer.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package defaults
33
import (
44
"fmt"
55
"github.com/springernature/halfpipe/manifest"
6+
"slices"
67
)
78

89
type tasksRenamer struct {
@@ -18,10 +19,8 @@ func getUniqueName(name string, previousNames []string, counter int) string {
1819
candidate = fmt.Sprintf("%s (%v)", name, counter)
1920
}
2021

21-
for _, previousName := range previousNames {
22-
if previousName == candidate {
23-
return getUniqueName(name, previousNames, counter+1)
24-
}
22+
if slices.Contains(previousNames, candidate) {
23+
return getUniqueName(name, previousNames, counter+1)
2524
}
2625

2726
return candidate

dependabot/filter.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dependabot
22

33
import (
4+
"slices"
5+
46
"github.com/sirupsen/logrus"
57
"path/filepath"
68
"strings"
@@ -16,11 +18,9 @@ type filter struct {
1618
}
1719

1820
func (f filter) shouldFilterOutEcosystem(path string, ecosystem string) bool {
19-
for _, skipEcosystem := range f.skipEcosystems {
20-
if skipEcosystem == ecosystem {
21-
logrus.Debugf("Removing '%s' due to filtered out ecosystem '%s'", path, ecosystem)
22-
return true
23-
}
21+
if slices.Contains(f.skipEcosystems, ecosystem) {
22+
logrus.Debugf("Removing '%s' due to filtered out ecosystem '%s'", path, ecosystem)
23+
return true
2424
}
2525
return false
2626
}

linters/docker-compose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func lintComposeFile(path string, dc manifest.DockerCompose, fs afero.Afero) (se
5151
func lintDockerComposeService(service string, composeFile string, composeContent []byte) (serviceExists bool, err error) {
5252
var compose struct {
5353
Version string
54-
Services map[string]interface{}
54+
Services map[string]any
5555
}
5656
e := yaml.Unmarshal(composeContent, &compose)
5757
if e != nil {

linters/result.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,5 @@ func deduplicate(errs []error) (errors []error) {
8585
}
8686

8787
func errorInErrors(err error, errs []error) bool {
88-
for _, e := range errs {
89-
if err == e {
90-
return true
91-
}
92-
}
93-
return false
88+
return slices.Contains(errs, err)
9489
}

manifest/buildpack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ type Buildpack struct {
88
Image string `json:"image,omitempty" yaml:"image,omitempty"`
99
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
1010
BuildHistory int `json:"build_history,omitempty" yaml:"build_history,omitempty"`
11-
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
11+
Notifications Notifications `json:"notifications" yaml:"notifications,omitempty"`
1212
Name string `json:"name,omitempty" yaml:"name,omitempty"`
1313
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
1414
ManualTrigger bool `json:"manual_trigger,omitempty" yaml:"manual_trigger,omitempty"`
@@ -45,7 +45,7 @@ func (p Buildpack) SetName(name string) Task {
4545
return p
4646
}
4747

48-
func (p Buildpack) MarshalYAML() (interface{}, error) {
48+
func (p Buildpack) MarshalYAML() (any, error) {
4949
p.Type = "buildpack"
5050
return p, nil
5151
}

manifest/consumer_integration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type ConsumerIntegrationTest struct {
1414
Vars Vars `yaml:"vars,omitempty" secretAllowed:"true"`
1515
Retries int `yaml:"retries,omitempty"`
1616
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
17-
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
17+
Notifications Notifications `json:"notifications" yaml:"notifications,omitempty"`
1818
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
1919
BuildHistory int `json:"build_history,omitempty" yaml:"build_history,omitempty"`
2020
UseCovenant bool `json:"use_covenant,omitempty" yaml:"use_covenant,omitempty"`
@@ -49,7 +49,7 @@ func (r ConsumerIntegrationTest) SetTimeout(timeout string) Task {
4949
return r
5050
}
5151

52-
func (r ConsumerIntegrationTest) MarshalYAML() (interface{}, error) {
52+
func (r ConsumerIntegrationTest) MarshalYAML() (any, error) {
5353
r.Type = "consumer-integration-test"
5454
return r, nil
5555
}

manifest/deploy_cf.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ type DeployCF struct {
2323
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
2424
Retries int `yaml:"retries,omitempty"`
2525
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
26-
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
26+
Notifications Notifications `json:"notifications" yaml:"notifications,omitempty"`
2727
PreStart []string `json:"pre_start,omitempty" yaml:"pre_start,omitempty"`
2828
Rolling bool `yaml:"rolling,omitempty"`
2929
IsDockerPush bool `json:"-" yaml:"-"`
3030
CliVersion string `json:"cli_version,omitempty" yaml:"cli_version,omitempty"`
3131
DockerTag string `json:"docker_tag,omitempty" yaml:"docker_tag,omitempty"`
3232
BuildHistory int `json:"build_history,omitempty" yaml:"build_history,omitempty"`
3333
SSORoute string `json:"sso_route,omitempty" yaml:"sso_route,omitempty"`
34-
GitHubEnvironment GitHubEnvironment `json:"github_environment,omitempty" yaml:"github_environment,omitempty"`
34+
GitHubEnvironment GitHubEnvironment `json:"github_environment" yaml:"github_environment,omitempty"`
3535

3636
CfApplication manifestparser.Application `json:"-" yaml:"-"`
3737
}
@@ -63,7 +63,7 @@ func (r DeployCF) SetName(name string) Task {
6363
return r
6464
}
6565

66-
func (r DeployCF) MarshalYAML() (interface{}, error) {
66+
func (r DeployCF) MarshalYAML() (any, error) {
6767
r.Type = "deploy-cf"
6868
return r, nil
6969
}

manifest/deploy_katee.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ type DeployKatee struct {
99
VelaManifest string `json:"vela_manifest,omitempty" yaml:"vela_manifest,omitempty"`
1010
Retries int `yaml:"retries,omitempty"`
1111
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
12-
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
12+
Notifications Notifications `json:"notifications" yaml:"notifications,omitempty"`
1313
Tag string `json:"tag,omitempty" yaml:"tag,omitempty"`
1414
BuildHistory int `json:"build_history,omitempty" yaml:"build_history,omitempty"`
1515
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
1616
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
1717
DeploymentCheckTimeout int `json:"deployment_check_timeout,omitempty" yaml:"deployment_check_timeout,omitempty"`
1818
CheckInterval int `json:"check_interval,omitempty" yaml:"check_interval,omitempty"`
1919
MaxChecks int `json:"max_checks,omitempty" yaml:"max_checks,omitempty"`
20-
GitHubEnvironment GitHubEnvironment `json:"github_environment,omitempty" yaml:"github_environment,omitempty"`
20+
GitHubEnvironment GitHubEnvironment `json:"github_environment" yaml:"github_environment,omitempty"`
2121
KateeManifest VelaManifest `json:"-" yaml:"-"`
2222
}
2323

@@ -87,7 +87,7 @@ func (d DeployKatee) SetBuildHistory(buildHistory int) Task {
8787
return d
8888
}
8989

90-
func (d DeployKatee) MarshalYAML() (interface{}, error) {
90+
func (d DeployKatee) MarshalYAML() (any, error) {
9191
d.Type = "deploy-katee"
9292
return d, nil
9393
}

manifest/deploy_ml_modules.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type DeployMLModules struct {
1010
ManualTrigger bool `json:"manual_trigger" yaml:"manual_trigger,omitempty"`
1111
Retries int `yaml:"retries,omitempty"`
1212
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
13-
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
13+
Notifications Notifications `json:"notifications" yaml:"notifications,omitempty"`
1414
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
1515
UseBuildVersion bool `json:"use_build_version,omitempty" yaml:"use_build_version,omitempty"`
1616
Username string `json:"username" yaml:"username,omitempty" secretAllowed:"true"`
@@ -46,7 +46,7 @@ func (r DeployMLModules) SetName(name string) Task {
4646
return r
4747
}
4848

49-
func (r DeployMLModules) MarshalYAML() (interface{}, error) {
49+
func (r DeployMLModules) MarshalYAML() (any, error) {
5050
r.Type = "deploy-ml-modules"
5151
return r, nil
5252
}

manifest/deploy_ml_zip.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type DeployMLZip struct {
1010
ManualTrigger bool `json:"manual_trigger" yaml:"manual_trigger,omitempty"`
1111
Retries int `yaml:"retries,omitempty"`
1212
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
13-
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
13+
Notifications Notifications `json:"notifications" yaml:"notifications,omitempty"`
1414
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
1515
UseBuildVersion bool `json:"use_build_version,omitempty" yaml:"use_build_version,omitempty"`
1616
Username string `json:"username" yaml:"username,omitempty" secretAllowed:"true"`
@@ -46,7 +46,7 @@ func (r DeployMLZip) SetName(name string) Task {
4646
return r
4747
}
4848

49-
func (r DeployMLZip) MarshalYAML() (interface{}, error) {
49+
func (r DeployMLZip) MarshalYAML() (any, error) {
5050
r.Type = "deploy-ml-zip"
5151
return r, nil
5252
}

0 commit comments

Comments
 (0)