checkpoint
This commit is contained in:
parent
72eff2b654
commit
87d8f0ad04
6 changed files with 19 additions and 7 deletions
|
@ -79,10 +79,9 @@ func (g *Client) DownloadMedia(url, path string) error {
|
|||
defer response.Body.Close()
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf(
|
||||
"did not receive an OK response from the GoToSocial server: got %d",
|
||||
response.StatusCode,
|
||||
)
|
||||
return BadStatusCodeError{
|
||||
statusCode: response.StatusCode,
|
||||
}
|
||||
}
|
||||
|
||||
file, err := os.Create(path)
|
||||
|
|
|
@ -31,6 +31,17 @@ func (e ResponseError) Error() string {
|
|||
)
|
||||
}
|
||||
|
||||
type BadStatusCodeError struct {
|
||||
statusCode int
|
||||
}
|
||||
|
||||
func (e BadStatusCodeError) Error() string {
|
||||
return fmt.Sprintf(
|
||||
"did not receive an OK response from the GoToSocial server: got %d",
|
||||
e.statusCode,
|
||||
)
|
||||
}
|
||||
|
||||
type Error struct {
|
||||
message string
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ func (m *MuteExecutor) muteStatus(gtsClient *client.Client) error {
|
|||
for _, mention := range status.Mentions {
|
||||
if mention.ID == myAccountID {
|
||||
canMute = true
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ func (m *UnmuteExecutor) unmuteStatus(gtsClient *client.Client) error {
|
|||
for _, mention := range status.Mentions {
|
||||
if mention.ID == myAccountID {
|
||||
canUnmute = true
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,11 +143,11 @@ func (p Printer) fullDisplayNameFormat(displayName, acct string) string {
|
|||
}
|
||||
|
||||
func (p Printer) formatDate(date time.Time) string {
|
||||
return date.Local().Format(dateFormat)
|
||||
return date.Local().Format(dateFormat) //nolint:gosmopolitan
|
||||
}
|
||||
|
||||
func (p Printer) formatDateTime(date time.Time) string {
|
||||
return date.Local().Format(dateTimeFormat)
|
||||
return date.Local().Format(dateTimeFormat) //nolint:gosmopolitan
|
||||
}
|
||||
|
||||
func (p Printer) print(text string) {
|
||||
|
|
|
@ -50,7 +50,7 @@ func OpenLink(browser, url string) error {
|
|||
cmd := strings.Split(browser, " ")
|
||||
cmd = append(cmd, url)
|
||||
|
||||
command := exec.Command(cmd[0], cmd[1:]...)
|
||||
command := exec.Command(cmd[0], cmd[1:]...) //nolint:gosec
|
||||
|
||||
if err := command.Start(); err != nil {
|
||||
return fmt.Errorf("received an error after starting the program to view the link: %w", err)
|
||||
|
|
Loading…
Reference in a new issue