mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Replace with anonymoud functions (#53386)
This commit is contained in:
parent
aee2856907
commit
ee8966344d
@ -99,7 +99,11 @@ func BuildManifest(ctx context.Context, dpath string, signingAdmin bool) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get signed manifest from Grafana API: %w", err)
|
||||
}
|
||||
defer logError(resp.Body.Close())
|
||||
defer func() {
|
||||
if err := resp.Body.Close(); err != nil {
|
||||
log.Println("failed to close response body, err: %w", err)
|
||||
}
|
||||
}()
|
||||
if resp.StatusCode != 200 {
|
||||
msg, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
@ -114,7 +118,11 @@ func BuildManifest(ctx context.Context, dpath string, signingAdmin bool) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create %s: %w", manifestPath, err)
|
||||
}
|
||||
defer logCloseError(f.Close)
|
||||
defer func() {
|
||||
if err := f.Close(); err != nil {
|
||||
log.Println("failed to close file, err: %w", err)
|
||||
}
|
||||
}()
|
||||
if _, err := io.Copy(f, resp.Body); err != nil {
|
||||
return fmt.Errorf("failed to write %s: %w", manifestPath, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user