golint & go vet
parent
e1b7bac4e6
commit
70b6261e34
|
@ -219,7 +219,7 @@ func (c *Client) AccountsSearch(q string, limit int64) ([]*Account, error) {
|
||||||
return accounts, nil
|
return accounts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Follow send follow-request.
|
// FollowRemoteUser send follow-request.
|
||||||
func (c *Client) FollowRemoteUser(uri string) (*Account, error) {
|
func (c *Client) FollowRemoteUser(uri string) (*Account, error) {
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
params.Set("uri", uri)
|
params.Set("uri", uri)
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
func cmdStream(c *cli.Context) error {
|
func cmdStream(c *cli.Context) error {
|
||||||
client := c.App.Metadata["client"].(*mastodon.Client)
|
client := c.App.Metadata["client"].(*mastodon.Client)
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
sc := make(chan os.Signal, 1)
|
sc := make(chan os.Signal, 1)
|
||||||
signal.Notify(sc, os.Interrupt)
|
signal.Notify(sc, os.Interrupt)
|
||||||
q, err := client.StreamingPublic(ctx)
|
q, err := client.StreamingPublic(ctx)
|
||||||
|
|
|
@ -54,7 +54,7 @@ func textContent(s string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
readUsername func() (string, error) = func() (string, error) {
|
readUsername = func() (string, error) {
|
||||||
b, _, err := bufio.NewReader(os.Stdin).ReadLine()
|
b, _, err := bufio.NewReader(os.Stdin).ReadLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -134,11 +134,11 @@ func authenticate(client *mastodon.Client, config *mastodon.Config, file string)
|
||||||
}
|
}
|
||||||
b, err := json.MarshalIndent(config, "", " ")
|
b, err := json.MarshalIndent(config, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to store file:", err)
|
return fmt.Errorf("failed to store file: %v", err)
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(file, b, 0700)
|
err = ioutil.WriteFile(file, b, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to store file:", err)
|
return fmt.Errorf("failed to store file: %v", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ type Attachment struct {
|
||||||
TextURL string `json:"text_url"`
|
TextURL string `json:"text_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Results hold information for search result.
|
||||||
type Results struct {
|
type Results struct {
|
||||||
Accounts []*Account `json:"accounts"`
|
Accounts []*Account `json:"accounts"`
|
||||||
Statuses []*Status `json:"statuses"`
|
Statuses []*Status `json:"statuses"`
|
||||||
|
|
|
@ -25,7 +25,7 @@ func (c *Client) GetNotifications() ([]*Notification, error) {
|
||||||
return notifications, nil
|
return notifications, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNotifications return notifications.
|
// GetNotification return notifications.
|
||||||
func (c *Client) GetNotification(id int64) (*Notification, error) {
|
func (c *Client) GetNotification(id int64) (*Notification, error) {
|
||||||
var notification Notification
|
var notification Notification
|
||||||
err := c.doAPI(http.MethodGet, fmt.Sprintf("/api/v1/notifications/%d", id), nil, ¬ification)
|
err := c.doAPI(http.MethodGet, fmt.Sprintf("/api/v1/notifications/%d", id), nil, ¬ification)
|
||||||
|
|
|
@ -33,8 +33,8 @@ type Status struct {
|
||||||
|
|
||||||
// Context hold information for mastodon context.
|
// Context hold information for mastodon context.
|
||||||
type Context struct {
|
type Context struct {
|
||||||
Ancestors []*Status `ancestors`
|
Ancestors []*Status `json:"ancestors"`
|
||||||
Descendants []*Status `descendants`
|
Descendants []*Status `json:"descendants"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Card hold information for mastodon card.
|
// Card hold information for mastodon card.
|
||||||
|
|
Loading…
Reference in New Issue