Skip to content

refactor: Use colon to separate context from wrapped error #642

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

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion common/pkg/capi/clustertopology/handlers/mutation/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (mgp metaGeneratePatches) CreateClusterGetter(
err = mgp.cl.Get(ctx, clusterKey, &cluster)
})
if err != nil {
return nil, fmt.Errorf("failed to fetch cluster %w", err)
return nil, fmt.Errorf("failed to fetch cluster: %w", err)
}
return &cluster, nil
}
Expand Down
2 changes: 1 addition & 1 deletion hack/tools/helm-cm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func createConfigMapFromDir(kustomizeDir string) (*corev1.ConfigMap, error) {
if !path.IsAbs(fullPath) {
wd, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("failed to get wd %w", err)
return nil, fmt.Errorf("failed to get wd: %w", err)
}
fullPath = path.Join(wd, kustomizeDir)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/generic/lifecycle/ccm/aws/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (a *AWSCCM) Apply(
log.Info("Creating AWS CCM ConfigMap for Cluster")
version, err := semver.ParseTolerant(cluster.Spec.Topology.Version)
if err != nil {
return fmt.Errorf("failed to parse version from cluster %w", err)
return fmt.Errorf("failed to parse version from cluster: %w", err)
}
minorVersion := fmt.Sprintf("%d.%d", version.Major, version.Minor)
configMapForMinorVersion := a.config.kubernetesMinorVersionToCCMConfigMapNames[minorVersion]
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/generic/lifecycle/ccm/nutanix/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (p *provider) Apply(

helmChart, err := p.helmChartInfoGetter.For(ctx, log, config.NutanixCCM)
if err != nil {
return fmt.Errorf("failed to get values for nutanix-ccm-config %w", err)
return fmt.Errorf("failed to get values for nutanix-ccm-config: %w", err)
}

// The configMap will contain the Helm values, but templated with fields that need to be filled in.
Expand Down
2 changes: 1 addition & 1 deletion pkg/handlers/generic/lifecycle/utils/scs.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func CreateStorageClassOnRemote(
for _, sc := range allStorageClasses {
err = client.ServerSideApply(ctx, remoteClient, sc, client.ForceOwnership)
if err != nil {
return fmt.Errorf("error creating storage class %v on remote cluster %w", sc, err)
return fmt.Errorf("error creating storage class %v on remote cluster: %w", sc, err)
}
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/handlers/generic/lifecycle/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func EnsureCRSForClusterFromObjects(

err := client.ServerSideApply(ctx, c, crs, client.ForceOwnership)
if err != nil {
return fmt.Errorf("failed to server side apply %w", err)
return fmt.Errorf("failed to server side apply: %w", err)
}

return nil
Expand Down Expand Up @@ -141,7 +141,7 @@ func EnsureNamespace(ctx context.Context, c ctrlclient.Client, ns *corev1.Namesp
}
err := client.ServerSideApply(ctx, c, ns)
if err != nil {
return fmt.Errorf("failed to server side apply %w", err)
return fmt.Errorf("failed to server side apply: %w", err)
}

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func getTemplateFromConfigMap(
func needHackCommands(cluster *clusterv1.Cluster) (bool, error) {
version, err := semver.ParseTolerant(cluster.Spec.Topology.Version)
if err != nil {
return false, fmt.Errorf("failed to parse version from cluster %w", err)
return false, fmt.Errorf("failed to parse version from cluster: %w", err)
}

return version.Minor >= 29, nil
Expand Down
Loading