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

chore: import packages only once #1387

Merged
merged 1 commit into from
Sep 25, 2023
Merged
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
7 changes: 3 additions & 4 deletions pkg/validate/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package validate
import (
"fmt"

build "github.com/shipwright-io/build/pkg/apis/build/v1alpha1"
buildv1alpha1 "github.com/shipwright-io/build/pkg/apis/build/v1alpha1"
)

Expand All @@ -25,7 +24,7 @@ func BuildRunVolumes(strategyVolumes []buildv1alpha1.BuildStrategyVolume, buildV
// validateBuildVolumes validates build overriding the build strategy volumes. in case it tries
// to override the non-overridable volume, or volume that does not exist in the strategy, it is
// good to fail early
func validateVolumes(strategyVolumes []build.BuildStrategyVolume, buildVolumes []build.BuildVolume) (bool, buildv1alpha1.BuildReason, string) {
func validateVolumes(strategyVolumes []buildv1alpha1.BuildStrategyVolume, buildVolumes []buildv1alpha1.BuildVolume) (bool, buildv1alpha1.BuildReason, string) {
strategyVolumesMap := toVolumeMap(strategyVolumes)

for _, buildVolume := range buildVolumes {
Expand All @@ -44,8 +43,8 @@ func validateVolumes(strategyVolumes []build.BuildStrategyVolume, buildVolumes [
}

// toVolumeMap coverts slice of build strategy volumes to map of build strategy volumes, in order to later search them quickly by name
func toVolumeMap(strategyVolumes []build.BuildStrategyVolume) map[string]build.BuildStrategyVolume {
res := make(map[string]build.BuildStrategyVolume)
func toVolumeMap(strategyVolumes []buildv1alpha1.BuildStrategyVolume) map[string]buildv1alpha1.BuildStrategyVolume {
res := make(map[string]buildv1alpha1.BuildStrategyVolume)
for _, vol := range strategyVolumes {
res[vol.Name] = vol
}
Expand Down