Skip to content

Commit d9a5166

Browse files
committed
stype(gofmt): gofmt code
1 parent dcca7bc commit d9a5166

41 files changed

Lines changed: 501 additions & 500 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
- docker
55
script:
66
- make bootstrap test
7+
- make test-cover
78
notifications:
89
slack:
910
rooms:

cmd/apps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (d *DryccCmd) AppDestroy(appID, confirm string) error {
245245
}
246246

247247
if confirm != appID {
248-
return fmt.Errorf("App %s does not match confirm %s, aborting.", appID, confirm)
248+
return fmt.Errorf("app %s does not match confirm %s, aborting", appID, confirm)
249249
}
250250

251251
startTime := time.Now()

cmd/apps_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func TestAppDestroy(t *testing.T) {
240240
}`)
241241
})
242242
err = cmdr.AppDestroy("lorem-ipsum", "bad-confirm-string")
243-
assert.Equal(t, err.Error(), `App lorem-ipsum does not match confirm bad-confirm-string, aborting.`, "output")
243+
assert.Equal(t, err.Error(), `app lorem-ipsum does not match confirm bad-confirm-string, aborting`, "output")
244244

245245
err = cmdr.AppDestroy("lorem-ipsum", "lorem-ipsum")
246246
assert.NoErr(t, err)

cmd/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (d *DryccCmd) Register(controller string, username string, password string,
5656
}
5757

5858
if password != passwordConfirm {
59-
return errors.New("Password mismatch, aborting registration.")
59+
return errors.New("password mismatch, aborting registration")
6060
}
6161
}
6262

@@ -182,7 +182,7 @@ func (d *DryccCmd) Passwd(username, password, newPassword string) error {
182182
}
183183

184184
if newPassword != passwordConfirm {
185-
return errors.New("Password mismatch, not changing.")
185+
return errors.New("password mismatch, not changing")
186186
}
187187
}
188188

cmd/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func parseConfig(configVars []string) (map[string]interface{}, error) {
268268
captures := regex.FindStringSubmatch(config)
269269
configMap[captures[1]] = captures[2]
270270
} else {
271-
return nil, fmt.Errorf("'%s' does not match the pattern 'key=var', ex: MODE=test\n", config)
271+
return nil, fmt.Errorf("'%s' does not match the pattern 'key=var', ex: MODE=test", config)
272272
}
273273
}
274274

cmd/ps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func parsePsTargets(targets []string) (map[string]int, error) {
154154
return nil, err
155155
}
156156
} else {
157-
return nil, fmt.Errorf("'%s' does not match the pattern 'type=num', ex: web=2\n", target)
157+
return nil, fmt.Errorf("'%s' does not match the pattern 'type=num', ex: web=2", target)
158158
}
159159
}
160160

cmd/ps_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ func TestParsePsTargets(t *testing.T) {
127127
t.Parallel()
128128

129129
cases := []psTargetCases{
130-
{[]string{"test"}, true, nil, "'test' does not match the pattern 'type=num', ex: web=2\n"},
131-
{[]string{"test=a"}, true, nil, "'test=a' does not match the pattern 'type=num', ex: web=2\n"},
132-
{[]string{"test="}, true, nil, "'test=' does not match the pattern 'type=num', ex: web=2\n"},
133-
{[]string{"Test=2"}, true, nil, "'Test=2' does not match the pattern 'type=num', ex: web=2\n"},
130+
{[]string{"test"}, true, nil, "'test' does not match the pattern 'type=num', ex: web=2"},
131+
{[]string{"test=a"}, true, nil, "'test=a' does not match the pattern 'type=num', ex: web=2"},
132+
{[]string{"test="}, true, nil, "'test=' does not match the pattern 'type=num', ex: web=2"},
133+
{[]string{"Test=2"}, true, nil, "'Test=2' does not match the pattern 'type=num', ex: web=2"},
134134
{[]string{"test=2"}, false, map[string]int{"test": 2}, ""},
135135
{[]string{"test-proc=2"}, false, map[string]int{"test-proc": 2}, ""},
136136
{[]string{"test1=2"}, false, map[string]int{"test1": 2}, ""},
@@ -157,7 +157,7 @@ func TestPsScale(t *testing.T) {
157157
var b bytes.Buffer
158158
cmdr := DryccCmd{WOut: &b, ConfigFile: cf}
159159
err = cmdr.PsScale("foo", []string{"test"})
160-
assert.Equal(t, err.Error(), "'test' does not match the pattern 'type=num', ex: web=2\n", "error")
160+
assert.Equal(t, err.Error(), "'test' does not match the pattern 'type=num', ex: web=2", "error")
161161

162162
server.Mux.HandleFunc("/v2/apps/foo/pods/", func(w http.ResponseWriter, r *http.Request) {
163163
testutil.SetHeaders(w)

cmd/services.go

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
11
package cmd
22

33
import (
4-
"fmt"
4+
"fmt"
55

6-
"github.com/drycc/pkg/prettyprint"
6+
"github.com/drycc/pkg/prettyprint"
77

8-
"github.com/drycc/controller-sdk-go/services"
8+
"github.com/drycc/controller-sdk-go/services"
99
)
1010

1111
// ServicesList lists extra services for the app
1212
func (d *DryccCmd) ServicesList(appID string) error {
13-
s, appID, err := load(d.ConfigFile, appID)
14-
15-
if err != nil {
16-
return err
17-
}
18-
19-
services, err := services.List(s.Client, appID)
20-
if d.checkAPICompatibility(s.Client, err) != nil {
21-
return err
22-
}
23-
24-
d.Printf("=== %s Services\n", appID)
25-
servicesMap := make(map[string]string)
26-
if len(services) > 0 {
27-
for _, service := range services {
28-
servicesMap[service.ProcfileType] = fmt.Sprintf("%v", service.PathPattern)
29-
}
30-
d.Print(prettyprint.PrettyTabs(servicesMap, 5))
31-
}
32-
return nil
13+
s, appID, err := load(d.ConfigFile, appID)
14+
15+
if err != nil {
16+
return err
17+
}
18+
19+
services, err := services.List(s.Client, appID)
20+
if d.checkAPICompatibility(s.Client, err) != nil {
21+
return err
22+
}
23+
24+
d.Printf("=== %s Services\n", appID)
25+
servicesMap := make(map[string]string)
26+
if len(services) > 0 {
27+
for _, service := range services {
28+
servicesMap[service.ProcfileType] = fmt.Sprintf("%v", service.PathPattern)
29+
}
30+
d.Print(prettyprint.PrettyTabs(servicesMap, 5))
31+
}
32+
return nil
3333
}
3434

3535
// ServicesAdd adds a service to an app.
3636
func (d *DryccCmd) ServicesAdd(appID, procfileType string, pathPattern string) error {
37-
s, appID, err := load(d.ConfigFile, appID)
37+
s, appID, err := load(d.ConfigFile, appID)
3838

39-
if err != nil {
40-
return err
41-
}
39+
if err != nil {
40+
return err
41+
}
4242

43-
d.Printf("Adding %s (%s) to %s... ", procfileType, pathPattern, appID)
43+
d.Printf("Adding %s (%s) to %s... ", procfileType, pathPattern, appID)
4444

45-
quit := progress(d.WOut)
46-
_, err = services.New(s.Client, appID, procfileType, pathPattern)
47-
quit <- true
48-
<-quit
49-
if d.checkAPICompatibility(s.Client, err) != nil {
50-
return err
51-
}
45+
quit := progress(d.WOut)
46+
_, err = services.New(s.Client, appID, procfileType, pathPattern)
47+
quit <- true
48+
<-quit
49+
if d.checkAPICompatibility(s.Client, err) != nil {
50+
return err
51+
}
5252

53-
d.Println("done")
54-
return nil
53+
d.Println("done")
54+
return nil
5555
}
5656

5757
// ServicesRemove removes a service for procfileType registered with an app.
5858
func (d *DryccCmd) ServicesRemove(appID, procfileType string) error {
59-
s, appID, err := load(d.ConfigFile, appID)
59+
s, appID, err := load(d.ConfigFile, appID)
6060

61-
if err != nil {
62-
return err
63-
}
61+
if err != nil {
62+
return err
63+
}
6464

65-
d.Printf("Removing %s from %s... ", procfileType, appID)
65+
d.Printf("Removing %s from %s... ", procfileType, appID)
6666

67-
quit := progress(d.WOut)
68-
err = services.Delete(s.Client, appID, procfileType)
69-
quit <- true
70-
<-quit
71-
if d.checkAPICompatibility(s.Client, err) != nil {
72-
return err
73-
}
67+
quit := progress(d.WOut)
68+
err = services.Delete(s.Client, appID, procfileType)
69+
quit <- true
70+
<-quit
71+
if d.checkAPICompatibility(s.Client, err) != nil {
72+
return err
73+
}
7474

75-
d.Println("done")
76-
return nil
75+
d.Println("done")
76+
return nil
7777
}

0 commit comments

Comments
 (0)