From d1b5f4b1fb5262121e5286b0547406c2e1224d52 Mon Sep 17 00:00:00 2001 From: 178inaba <178inaba@users.noreply.github.com> Date: Thu, 20 Apr 2017 21:29:10 +0900 Subject: [PATCH] Fix for ineffassign . --- accounts_test.go | 4 ++-- cmd/mstdn/main.go | 3 ++- mastodon.go | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/accounts_test.go b/accounts_test.go index d764000..1e3a0a7 100644 --- a/accounts_test.go +++ b/accounts_test.go @@ -193,11 +193,11 @@ func TestGetAccountFollowing(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) - fl, err := client.GetAccountFollowing(context.Background(), 123) + _, err := client.GetAccountFollowing(context.Background(), 123) if err == nil { t.Fatalf("should be fail: %v", err) } - fl, err = client.GetAccountFollowing(context.Background(), 1234567) + fl, err := client.GetAccountFollowing(context.Background(), 1234567) if err != nil { t.Fatalf("should not be fail: %v", err) } diff --git a/cmd/mstdn/main.go b/cmd/mstdn/main.go index ca268c6..4226be3 100644 --- a/cmd/mstdn/main.go +++ b/cmd/mstdn/main.go @@ -78,7 +78,8 @@ func prompt() (string, string, error) { fmt.Print("Password: ") var password string if readPassword == nil { - t, err := tty.Open() + var t *tty.TTY + t, err = tty.Open() if err != nil { return "", "", err } diff --git a/mastodon.go b/mastodon.go index df97f22..16ccb08 100644 --- a/mastodon.go +++ b/mastodon.go @@ -128,6 +128,9 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in ct = mw.FormDataContentType() } else { req, err = http.NewRequest(method, u.String(), nil) + if err != nil { + return err + } } req = req.WithContext(ctx) req.Header.Set("Authorization", "Bearer "+c.config.AccessToken)