Skip to content

Commit f4052c2

Browse files
authored
Merge pull request #9 from michaellihs/master
Fix some typos
2 parents 3f0e9e4 + c4ab5d5 commit f4052c2

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

gitlab.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
logrus "github.com/sirupsen/logrus"
1515
)
1616

17-
const gitlabSiginPath = "/users/sign_in"
17+
const gitlabSignInPath = "/users/sign_in"
1818
const gitlabPersonalAccessTokenURLPath = "/profile/personal_access_tokens"
1919

2020
// GitLabTokenRequest describes the token Request
@@ -38,7 +38,7 @@ func CreateToken(gr GitLabTokenRequest) (string, error) {
3838
Jar: jar,
3939
}
4040

41-
loginURL, err := url.Parse(gr.URL + gitlabSiginPath)
41+
loginURL, err := url.Parse(gr.URL + gitlabSignInPath)
4242

4343
if err != nil {
4444
return "", err
@@ -66,7 +66,7 @@ func CreateToken(gr GitLabTokenRequest) (string, error) {
6666
if err != nil {
6767
return "", err
6868
}
69-
token, err := findPersonaAccessToken(responseBody)
69+
token, err := findPersonalAccessToken(responseBody)
7070
if err != nil {
7171
return "", err
7272
}
@@ -121,18 +121,18 @@ func addExpiry(values url.Values, date string) (url.Values, error) {
121121
}
122122
dateparts := strings.Split(date, "-")
123123
if len(dateparts) < 3 {
124-
return nil, errors.New("Date is to short it should be formatted like this 2017-12-03")
124+
return nil, errors.New("Date is too short it should be formatted like this 2017-12-03")
125125
}
126126

127127
if len(dateparts[0]) < 4 {
128-
return nil, errors.New("Year is to short")
128+
return nil, errors.New("Year is too short")
129129
}
130130

131131
if len(dateparts[1]) < 2 {
132-
return nil, errors.New("Month is to short needs to be with zero digest")
132+
return nil, errors.New("Month is too short needs to be with zero digest")
133133
}
134134
if len(dateparts[2]) < 2 {
135-
return nil, errors.New("Day is to short needs to be with zero digest")
135+
return nil, errors.New("Day is too short needs to be with zero digest")
136136
}
137137
values.Add("personal_access_token[expires_at]", date)
138138
return values, nil
@@ -154,7 +154,7 @@ func findCSRFToken(htmlBody string) map[string]string {
154154
return m
155155
}
156156

157-
func findPersonaAccessToken(htmlBody string) (string, error) {
157+
func findPersonalAccessToken(htmlBody string) (string, error) {
158158
doc := soup.HTMLParse(htmlBody)
159159
found := doc.Find("input", "id", "created-personal-access-token")
160160
if found.Pointer == nil {

gitlab_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ func TestExpiryWithEmptyDate(t *testing.T) {
2424
func TestExpiryWithWrongDateAtYear(t *testing.T) {
2525
date, err := addExpiry(url.Values{}, "201-11-01")
2626
assert.NotNil(t, err)
27-
assert.Equal(t, errors.New("Year is to short"), err)
27+
assert.Equal(t, errors.New("Year is too short"), err)
2828
assert.Empty(t, date)
2929
}
3030

3131
func TestExpiryWithWrongDateAtMonth(t *testing.T) {
3232
date, err := addExpiry(url.Values{}, "2016-1-01")
3333
assert.NotNil(t, err)
34-
assert.Equal(t, errors.New("Month is to short needs to be with zero digest"), err)
34+
assert.Equal(t, errors.New("Month is too short needs to be with zero digest"), err)
3535
assert.Empty(t, date)
3636
}
3737

3838
func TestExpiryWithWrongDateAtDay(t *testing.T) {
3939
date, err := addExpiry(url.Values{}, "2016-11-1")
4040
assert.NotNil(t, err)
41-
assert.Equal(t, errors.New("Day is to short needs to be with zero digest"), err)
41+
assert.Equal(t, errors.New("Day is too short needs to be with zero digest"), err)
4242
assert.Empty(t, date)
4343
}
4444

4545
func TestExpiryWithWrongDateFormat(t *testing.T) {
4646
date, err := addExpiry(url.Values{}, "2016/11/01")
4747
assert.NotNil(t, err)
48-
assert.Equal(t, errors.New("Date is to short it should be formatted like this 2017-12-03"), err)
48+
assert.Equal(t, errors.New("Date is too short it should be formatted like this 2017-12-03"), err)
4949
assert.Empty(t, date)
5050
}
5151

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
// VERSION indicates which version of the binary is running.
1313
var VERSION string
1414

15-
const gitlabDefaulURL = "https://gitlab.com"
15+
const gitlabDefaultURL = "https://gitlab.com"
1616

1717
// preload initializes any global options and configuration
1818
// before the main or sub commands are run.
@@ -91,7 +91,7 @@ func main() {
9191
func create(c *cli.Context) {
9292
url := c.Args().Get(0)
9393
if url == "" {
94-
url = gitlabDefaulURL
94+
url = gitlabDefaultURL
9595
}
9696
user := c.String("user")
9797
if user == "" {

0 commit comments

Comments
 (0)