@@ -139,9 +139,9 @@ func getRegistryClientWrap(cfg *RegistryClientConfig) (*registryClientWrap, erro
139139
140140// PullChart retrieves the specified chart
141141func PullChart (chartURL , version string , destDir string , opts ... RegistryClientOption ) (string , error ) {
142- u , urlErr := url .Parse (chartURL )
143- if urlErr != nil {
144- return "" , fmt .Errorf ("invalid url: %w" , urlErr )
142+ u , err := url .Parse (chartURL )
143+ if err != nil {
144+ return "" , fmt .Errorf ("invalid url: %w" , err )
145145 }
146146 cfg := & action.Configuration {}
147147 cc := NewRegistryClientConfig (opts ... )
@@ -151,7 +151,7 @@ func PullChart(chartURL, version string, destDir string, opts ...RegistryClientO
151151 }
152152 cfg .RegistryClient = reg .client
153153 if cc .Auth .Username != "" && cc .Auth .Password != "" && reg .credentialsFile != "" {
154- if err : = reg .client .Login (u .Host , registry .LoginOptBasicAuth (cc .Auth .Username , cc .Auth .Password )); err != nil {
154+ if err = reg .client .Login (u .Host , registry .LoginOptBasicAuth (cc .Auth .Username , cc .Auth .Password )); err != nil {
155155 return "" , fmt .Errorf ("error logging in to %s: %w" , u .Host , err )
156156 }
157157 defer func () {
@@ -161,21 +161,21 @@ func PullChart(chartURL, version string, destDir string, opts ...RegistryClientO
161161 }
162162 client := action .NewPullWithOpts (action .WithConfig (cfg ))
163163
164- dir , mkdirErr := os .MkdirTemp (destDir , "chart-*" )
165- if mkdirErr != nil {
166- return "" , fmt .Errorf ("failed to upload Helm chart: failed to create temp directory: %w" , mkdirErr )
164+ dir , err := os .MkdirTemp (destDir , "chart-*" )
165+ if err != nil {
166+ return "" , fmt .Errorf ("failed to upload Helm chart: failed to create temp directory: %w" , err )
167167 }
168168 client .Settings = cli .New ()
169169 client .DestDir = dir
170170 client .Untar = true
171171 client .Version = version
172- if _ , err : = client .Run (chartURL ); err != nil {
172+ if _ , err = client .Run (chartURL ); err != nil {
173173 return "" , fmt .Errorf ("failed to pull Helm chart: %w" , err )
174174 }
175175
176- charts , globErr := filepath .Glob (filepath .Join (dir , "*/Chart.yaml" ))
177- if globErr != nil {
178- return "" , fmt .Errorf ("failed to located fetched Helm charts: %w" , globErr )
176+ charts , err := filepath .Glob (filepath .Join (dir , "*/Chart.yaml" ))
177+ if err != nil {
178+ return "" , fmt .Errorf ("failed to located fetched Helm charts: %w" , err )
179179 }
180180 if len (charts ) == 0 {
181181 return "" , fmt .Errorf ("cannot find any Helm chart" )
@@ -212,10 +212,10 @@ func showRemoteHelmChart(chartURL string, version string, cfg *RegistryClientCon
212212 client .SetRegistryClient (reg .client )
213213 client .Version = version
214214 cp , err := client .LocateChart (chartURL , cli .New ())
215-
216215 if err != nil {
217216 return "" , err
218217 }
218+
219219 return client .Run (cp )
220220}
221221
0 commit comments