Skip to content

Commit 4733ac5

Browse files
author
Daisuke Miyamoto
committed
Merge branch 'release/0.2.1'
2 parents 208f1c5 + 4ea51f5 commit 4733ac5

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

oauth2.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ func authorizationCodeFlow(oauth2Conf *oauth2.Config) (*oauth2.Token, bool, erro
6767

6868
reader := bufio.NewReader(os.Stdin)
6969
fmt.Fprint(os.Stderr, "Enter code: ")
70-
if code, err := reader.ReadString('\n'); err != nil {
70+
if code, _, err := reader.ReadLine(); err != nil {
7171
return &oauth2.Token{}, true, err
72-
} else if tok, err := oauth2Conf.Exchange(oauth2.NoContext, trimSuffix(code, "\n")); err != nil {
72+
} else if tok, err := oauth2Conf.Exchange(oauth2.NoContext, string(code)); err != nil {
7373
return &oauth2.Token{}, true, err
7474
} else {
7575
return tok, true, nil
@@ -131,13 +131,6 @@ func random() string {
131131
return strconv.FormatUint(n, 36)
132132
}
133133

134-
func trimSuffix(s, suffix string) string {
135-
if strings.HasSuffix(s, suffix) {
136-
s = s[:len(s)-len(suffix)]
137-
}
138-
return s
139-
}
140-
141134
func condVal(v string) []string {
142135
if v == "" {
143136
return nil

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package main
22

3-
const Version string = "0.2"
3+
const Version string = "0.2.1"

0 commit comments

Comments
 (0)