Skip to content

Commit

Permalink
fix: fix golangci-lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
crandles committed Oct 25, 2024
1 parent 15e167f commit 72eb7e1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func (e *testEnv) processTestFeature(ctx context.Context, t *testing.T, featureN
t.Helper()
skipped, message := e.requireFeatureProcessing(feature)
if skipped {
t.Skipf(message)
t.Skip(message)
}
// execute beforeEachFeature actions
ctx = e.processFeatureActions(ctx, t, feature, e.getBeforeFeatureActions())
Expand Down Expand Up @@ -510,7 +510,7 @@ func (e *testEnv) execFeature(ctx context.Context, t *testing.T, featName string
internalT.Helper()
skipped, message := e.requireAssessmentProcessing(assess, i+1)
if skipped {
internalT.Skipf(message)
internalT.Skip(message)
}
// Set shouldFailNow to true before actually running the assessment, because if the assessment
// calls t.FailNow(), the function will be abruptly stopped in the middle of `e.executeSteps()`.
Expand Down
19 changes: 10 additions & 9 deletions third_party/flux/flux_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package flux

import (
"context"
"errors"
"fmt"

"sigs.k8s.io/e2e-framework/pkg/env"
Expand All @@ -44,7 +45,7 @@ func InstallFlux(opts ...Option) env.Func {
func CreateGitRepo(gitRepoName, gitRepoURL string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.createSource(Git, gitRepoName, gitRepoURL, opts...)
if err != nil {
Expand All @@ -58,7 +59,7 @@ func CreateGitRepo(gitRepoName, gitRepoURL string, opts ...Option) env.Func {
func CreateHelmRepository(name, url string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.createSource(Helm, name, url, opts...)
if err != nil {
Expand All @@ -72,7 +73,7 @@ func CreateHelmRepository(name, url string, opts ...Option) env.Func {
func CreateKustomization(kustomizationName, sourceRef string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.createKustomization(kustomizationName, sourceRef, opts...)
if err != nil {
Expand All @@ -87,7 +88,7 @@ func CreateKustomization(kustomizationName, sourceRef string, opts ...Option) en
func CreateHelmRelease(name, source, chart string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.createHelmRelease(name, source, chart, opts...)
if err != nil {
Expand All @@ -101,7 +102,7 @@ func CreateHelmRelease(name, source, chart string, opts ...Option) env.Func {
func UninstallFlux(opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.uninstallFlux(opts...)
if err != nil {
Expand All @@ -115,7 +116,7 @@ func UninstallFlux(opts ...Option) env.Func {
func DeleteKustomization(kustomizationName string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.deleteKustomization(kustomizationName, opts...)
if err != nil {
Expand All @@ -129,7 +130,7 @@ func DeleteKustomization(kustomizationName string, opts ...Option) env.Func {
func DeleteHelmRelease(name string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.deleteHelmRelease(name, opts...)
if err != nil {
Expand All @@ -143,7 +144,7 @@ func DeleteHelmRelease(name string, opts ...Option) env.Func {
func DeleteGitRepo(gitRepoName string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.deleteSource(Git, gitRepoName, opts...)
if err != nil {
Expand All @@ -157,7 +158,7 @@ func DeleteGitRepo(gitRepoName string, opts ...Option) env.Func {
func DeleteHelmRepo(name string, opts ...Option) env.Func {
return func(ctx context.Context, c *envconf.Config) (context.Context, error) {
if manager == nil {
return ctx, fmt.Errorf(NoFluxInstallationFoundMsg)
return ctx, errors.New(NoFluxInstallationFoundMsg)
}
err := manager.deleteSource(Helm, name, opts...)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion third_party/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package helm

import (
"bytes"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -237,7 +238,7 @@ func (m *Manager) run(opts *Opts) (err error) {
}
log.V(4).InfoS("Determining if helm binary is available or not", "executable", m.path)
if m.e.Prog().Avail(m.path) == "" {
err = fmt.Errorf(missingHelm)
err = errors.New(missingHelm)
return
}
command, err := m.getCommand(opts)
Expand Down
3 changes: 2 additions & 1 deletion third_party/ko/ko.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package ko
import (
"bytes"
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -159,7 +160,7 @@ func (m *Manager) GetLocalImage(ctx context.Context, packagePath string) (string
func (m *Manager) run(opts *Opts) (out string, err error) {
log.V(4).InfoS("Determining if ko binary is available or not", "executable", m.path)
if m.e.Prog().Avail(m.path) == "" {
return "", fmt.Errorf(missingKo)
return "", errors.New(missingKo)
}

envs := m.getEnvs(opts)
Expand Down
3 changes: 2 additions & 1 deletion third_party/kubetest2/pkg/tester/e2e-tester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ limitations under the License.
package tester

import (
"github.com/octago/sflags/gen/gpflag"
"testing"

"github.com/octago/sflags/gen/gpflag"
)

func TestBuildFlags(t *testing.T) {
Expand Down

0 comments on commit 72eb7e1

Please sign in to comment.