Skip to content

Commit

Permalink
Fix aw0k3n linter
Browse files Browse the repository at this point in the history
  • Loading branch information
cardil committed Apr 11, 2024
1 parent feab0fa commit 79bb37a
Show file tree
Hide file tree
Showing 19 changed files with 29 additions and 29 deletions.
2 changes: 0 additions & 2 deletions magetasks/tests/example/.env

This file was deleted.

1 change: 0 additions & 1 deletion magetasks/tests/example/.ko.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions magetasks/tests/project_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func TestProjectBuild(t *testing.T) {
if testing.Short() {
t.Skip("short tests only")
}
c := mkCmd("./example", "./mage", "clean", "build")
c := mkCmd("./testdata", "./mage", "clean", "build")
assertCommandStarted(t, c)
assertCommandSucceded(t, c)
c = mkCmd("./example/build/_output/bin",
c = mkCmd("./testdata/build/_output/bin",
fmt.Sprintf("./other-%s-%s", runtime.GOOS, runtime.GOARCH))
assertCommandStarted(t, c)
assertCommandSucceded(t, c)
Expand Down
2 changes: 2 additions & 0 deletions magetasks/tests/testdata/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IMAGE_BASENAME=ghcr.io/knative/toolbox/magetasks/testdata
IMAGE_BASENAME_SEPARATOR=/
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions magetasks/tests/testdata/.ko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaultBaseImage: registry.access.redhat.com/ubi9/ubi-minimal
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"knative.dev/toolbox/magetasks/pkg/checks"
"knative.dev/toolbox/magetasks/pkg/image"
"knative.dev/toolbox/magetasks/pkg/knative"
"knative.dev/toolbox/magetasks/tests/example/build/overrides"
"knative.dev/toolbox/magetasks/tests/example/pkg/metadata"
"knative.dev/toolbox/magetasks/tests/testdata/build/overrides"
"knative.dev/toolbox/magetasks/tests/testdata/pkg/metadata"
)

// Default target is set to Build
Expand All @@ -42,10 +42,10 @@ func init() { //nolint:gochecknoinits
archs := []platform.Architecture{
platform.AMD64, platform.ARM64, platform.S390X, platform.PPC64LE,
}
dummy := artifact.Image{
Metadata: config.Metadata{Name: "dummy"},
placeholder := artifact.Image{
Metadata: config.Metadata{Name: "placeholder"},
Labels: map[string]config.Resolver{
"description": config.StaticResolver("A dummy image description"),
"description": config.StaticResolver("A placeholder image description"),
},
Architectures: archs,
}
Expand All @@ -58,9 +58,9 @@ func init() { //nolint:gochecknoinits
Name: "other",
BuildVariables: buildvars.Assemble([]buildvars.Operator{
image.InfluenceableReference{
Path: metadata.ImagePath(metadata.DummyImage),
EnvVariable: "MAGETASKS_EXAMPLE_DUMMY_IMAGE",
Image: dummy,
Path: metadata.ImagePath(metadata.PlaceholderImage),
EnvVariable: "MAGETASKS_EXAMPLE_PLACEHOLDER_IMAGE",
Image: placeholder,
},
image.InfluenceableReference{
Path: metadata.ImagePath(metadata.SampleImage),
Expand All @@ -82,7 +82,7 @@ func init() { //nolint:gochecknoinits
Path: metadata.VersionPath(), Resolver: knative.NewVersionResolver(),
},
Artifacts: []config.Artifact{
dummy, sampleimage, other,
placeholder, sampleimage, other,
},
Checks: []config.Task{
checks.GolangCiLint(func(opts *checks.GolangCiLintOptions) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ package main
import (
"log"

"knative.dev/toolbox/magetasks/tests/example/pkg/metadata"
"knative.dev/toolbox/magetasks/tests/testdata/pkg/metadata"
)

func main() {
log.Printf("Version: %s\n", metadata.Version)
log.Println("Images:")
images := []metadata.Image{
metadata.DummyImage,
metadata.PlaceholderImage,
metadata.SampleImage,
}
for _, image := range images {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ package main
import (
"log"

"knative.dev/toolbox/magetasks/tests/example/pkg/metadata"
"knative.dev/toolbox/magetasks/tests/testdata/pkg/metadata"
)

func main() {
log.Printf("Dummy code! Version: %s\n", metadata.Version)
log.Printf("Placeholder code! Version: %s\n", metadata.Version)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package main
import (
"log"

"knative.dev/toolbox/magetasks/tests/example/pkg/metadata"
"knative.dev/toolbox/magetasks/tests/testdata/pkg/metadata"
)

func main() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
)

var (
// DummyImageRef holds information about companion dummy image.
DummyImageRef = "" //nolint:gochecknoglobals
// PlaceholderImageRef holds information about companion placeholder image.
PlaceholderImageRef = "" //nolint:gochecknoglobals
// SampleImageRef holds information about companion sample image.
SampleImageRef = "" //nolint:gochecknoglobals
// ImageBasename holds a basename of a image, so the development reference
Expand All @@ -37,20 +37,20 @@ var (
type Image string

const (
// DummyImage represents a dummy image.
DummyImage Image = "dummy"
// PlaceholderImage represents a placeholder image.
PlaceholderImage Image = "placeholder"
// SampleImage represents a sample image.
SampleImage Image = "sampleimage"
)

// ResolveImage will try to resolve the image reference from set values. If
// DummyImageRef is given it will be used, otherwise the ImageBasename and Version will
// PlaceholderImageRef is given it will be used, otherwise the ImageBasename and Version will
// be used.
func ResolveImage(image Image) string {
ref := func() string {
switch image {
case DummyImage:
return DummyImageRef
case PlaceholderImage:
return PlaceholderImageRef
case SampleImage:
return SampleImageRef
}
Expand All @@ -68,8 +68,8 @@ func ResolveImage(image Image) string {
func ImagePath(image Image) string {
variable := func() string {
switch image {
case DummyImage:
return "DummyImageRef"
case PlaceholderImage:
return "PlaceholderImageRef"
case SampleImage:
return "SampleImageRef"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"testing"

"gotest.tools/v3/assert"
"knative.dev/toolbox/magetasks/tests/example/pkg/metadata"
"knative.dev/toolbox/magetasks/tests/testdata/pkg/metadata"
)

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

0 comments on commit 79bb37a

Please sign in to comment.