- refactor http.Get
This commit is contained in:
@@ -270,9 +270,7 @@ func (s SkuList) Swap(i, j int) {
|
||||
func DownloadFileByURL(fileURL string) (bodyData []byte, fileMD5 string, err error) {
|
||||
response, err := http.Get(fileURL)
|
||||
if err == nil {
|
||||
defer func() {
|
||||
response.Body.Close()
|
||||
}()
|
||||
defer response.Body.Close()
|
||||
if response.StatusCode == http.StatusOK {
|
||||
if bodyData, err = ioutil.ReadAll(response.Body); err == nil {
|
||||
fileMD5 = fmt.Sprintf("%X", md5.Sum(bodyData))
|
||||
|
||||
Reference in New Issue
Block a user