Skip to content

Commit a203c08

Browse files
committed
chore: simplify logic
Signed-off-by: juan131 <juan.ariza@broadcom.com>
1 parent 0eaba61 commit a203c08

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

cmd/dt/wrap/wrap.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,17 @@ func ResolveInputChartPath(inputPath string, cfg *Config) (string, error) {
220220
l := cfg.GetLogger()
221221
var chartPath string
222222

223-
tmpDir, tmpErr := cfg.GetTemporaryDirectory()
224-
if tmpErr != nil {
225-
return "", fmt.Errorf("failed to create temporary directory: %w", tmpErr)
223+
tmpDir, err := cfg.GetTemporaryDirectory()
224+
if err != nil {
225+
return "", fmt.Errorf("failed to create temporary directory: %w", err)
226226
}
227227

228228
if chartutils.IsRemoteChart(inputPath) {
229-
if err := l.ExecuteStep("Fetching remote Helm chart", func() error {
230-
var fetchErr error
229+
if err = l.ExecuteStep("Fetching remote Helm chart", func() error {
231230
version := cfg.Version
232-
chartPath, fetchErr = fetchRemoteChart(inputPath, version, tmpDir, cfg)
233-
if fetchErr != nil {
234-
return fetchErr
231+
chartPath, err = fetchRemoteChart(inputPath, version, tmpDir, cfg)
232+
if err != nil {
233+
return err
235234
}
236235

237236
return nil
@@ -391,8 +390,8 @@ func wrapChart(inputPath string, opts ...Option) (string, error) {
391390

392391
if cfg.ShouldFetchChartArtifacts(inputPath) {
393392
chartURL := fmt.Sprintf("%s:%s", inputPath, chart.Version())
394-
if fetchErr := fetchArtifacts(chartURL, filepath.Join(wrap.RootDir(), artifacts.HelmChartArtifactMetadataDir), subCfg); fetchErr != nil {
395-
return "", fetchErr
393+
if err = fetchArtifacts(chartURL, filepath.Join(wrap.RootDir(), artifacts.HelmChartArtifactMetadataDir), subCfg); err != nil {
394+
return "", err
396395
}
397396
}
398397

0 commit comments

Comments
 (0)