Plugins: Optimize creation of Golang errors and slices (#69448)

* tidy up

* fix tests
This commit is contained in:
Will Browne
2023-06-07 17:22:43 +02:00
committed by GitHub
parent 8a8b5da1ee
commit 1fd4953833
13 changed files with 72 additions and 66 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"crypto/sha256"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io"
"net"
@@ -129,7 +130,7 @@ func (c *Client) downloadFile(tmpFile *os.File, pluginURL, checksum string, comp
c.retryCount = 0
failure := fmt.Sprintf("%v", r)
if failure == "runtime error: makeslice: len out of range" {
err = fmt.Errorf("corrupt HTTP response from source, please try again")
err = errors.New("corrupt HTTP response from source, please try again")
} else {
panic(r)
}