go: remove redundant if-err check

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-03-20 11:06:51 +01:00
parent 0036b24266
commit 658cac046f
5 changed files with 10 additions and 48 deletions

View File

@ -71,11 +71,7 @@ func (h *Client) InstallConstellationServices(ctx context.Context, release helm.
mergedVals := helm.MergeMaps(release.Values, extraVals)
if err := h.install(ctx, release.Chart, mergedVals); err != nil {
return err
}
return nil
return h.install(ctx, release.Chart, mergedVals)
}
// InstallCertManager installs the cert-manager chart.
@ -84,11 +80,7 @@ func (h *Client) InstallCertManager(ctx context.Context, release helm.Release) e
h.Wait = release.Wait
h.Timeout = 10 * time.Minute
if err := h.install(ctx, release.Chart, release.Values); err != nil {
return err
}
return nil
return h.install(ctx, release.Chart, release.Values)
}
// InstallOperators installs the Constellation Operators.
@ -98,11 +90,7 @@ func (h *Client) InstallOperators(ctx context.Context, release helm.Release, ext
mergedVals := helm.MergeMaps(release.Values, extraVals)
if err := h.install(ctx, release.Chart, mergedVals); err != nil {
return err
}
return nil
return h.install(ctx, release.Chart, mergedVals)
}
// InstallCilium sets up the cilium pod network.
@ -128,10 +116,7 @@ func (h *Client) installCiliumGeneric(ctx context.Context, release helm.Release,
release.Values["k8sServiceHost"] = host
release.Values["k8sServicePort"] = strconv.Itoa(constants.KubernetesPort)
if err := h.install(ctx, release.Chart, release.Values); err != nil {
return err
}
return nil
return h.install(ctx, release.Chart, release.Values)
}
func (h *Client) installCiliumGCP(ctx context.Context, kubectl k8sapi.Client, release helm.Release, nodeName, nodePodCIDR, subnetworkPodCIDR, kubeAPIEndpoint string) error {
@ -179,11 +164,7 @@ func (h *Client) installCiliumGCP(ctx context.Context, kubectl k8sapi.Client, re
release.Values["k8sServicePort"] = port
}
if err := h.install(ctx, release.Chart, release.Values); err != nil {
return err
}
return nil
return h.install(ctx, release.Chart, release.Values)
}
// install tries to install the given chart and aborts after ~5 tries.

View File

@ -573,11 +573,7 @@ func (c *gcpIAMCreator) parseAndWriteIDFile(iamFile iamid.File, fileHandler file
return err
}
if err := fileHandler.WriteJSON(constants.GCPServiceAccountKeyFile, tmpOut, file.OptNone); err != nil {
return err
}
return nil
return fileHandler.WriteJSON(constants.GCPServiceAccountKeyFile, tmpOut, file.OptNone)
}
// parseIDFile parses the given base64 encoded JSON string of the GCP service account key and returns a map.

View File

@ -190,11 +190,8 @@ func (i *initCmd) initialize(cmd *cobra.Command, newDialer func(validator *cloud
i.log.Debugf("Initialization request succeeded")
i.log.Debugf("Writing Constellation ID file")
idFile.CloudProvider = provider
if err := i.writeOutput(idFile, resp, flags.mergeConfigs, cmd.OutOrStdout(), fileHandler); err != nil {
return err
}
return nil
return i.writeOutput(idFile, resp, flags.mergeConfigs, cmd.OutOrStdout(), fileHandler)
}
func (i *initCmd) initCall(ctx context.Context, dialer grpcDialer, ip string, req *initproto.InitRequest) (*initproto.InitResponse, error) {

View File

@ -430,11 +430,7 @@ func (v *versionUpgrade) writeConfig(conf *config.Config, fileHandler file.Handl
conf.UpdateMeasurements(v.newImages[imageUpgrade])
}
if err := fileHandler.WriteYAML(configPath, conf, file.OptOverwrite); err != nil {
return err
}
return nil
return fileHandler.WriteYAML(configPath, conf, file.OptOverwrite)
}
// getCurrentImageVersion retrieves the semantic version of the image currently installed in the cluster.

View File

@ -79,11 +79,7 @@ func (c *Client) PrepareWorkspace(path string, vars Variables) error {
return err
}
if err := c.writeVars(vars); err != nil {
return err
}
return nil
return c.writeVars(vars)
}
// CreateCluster creates a Constellation cluster using Terraform.
@ -303,11 +299,7 @@ func (c *Client) RemoveInstaller() {
// CleanUpWorkspace removes terraform files from the current directory.
func (c *Client) CleanUpWorkspace() error {
if err := cleanUpWorkspace(c.file, c.workingDir); err != nil {
return err
}
return nil
return cleanUpWorkspace(c.file, c.workingDir)
}
// GetExecutable returns a Terraform executable either from the local filesystem,