chore: update golangci-lint config

This commit is contained in:
Steven
2023-09-17 22:55:13 +08:00
parent 9eb077c4af
commit cd0ea6558d
72 changed files with 272 additions and 187 deletions

View File

@@ -2,10 +2,11 @@ package telegram
import (
"context"
"fmt"
"io"
"net/http"
"strings"
"github.com/pkg/errors"
)
func (b *Bot) downloadAttachment(ctx context.Context, message *Message) (*Attachment, error) {
@@ -92,13 +93,13 @@ func (b *Bot) downloadFilepath(ctx context.Context, filePath string) ([]byte, er
resp, err := http.Get(fileURL + "/" + filePath)
if err != nil {
return nil, fmt.Errorf("fail to http.Get: %s", err)
return nil, errors.Wrap(err, "fail to http.Get")
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("fail to io.ReadAll: %s", err)
return nil, errors.Wrap(err, "fail to io.ReadAll")
}
return body, nil