Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 3727683

Browse files
author
Matthieu Nottale
committed
Fix preious commit: typos and linting.
Signed-off-by: Matthieu Nottale <[email protected]>
1 parent 426102f commit 3727683

26 files changed

+1751
-316
lines changed

Gopkg.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packager/extract.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"io"
66
"io/ioutil"
77
"os"
8+
9+
"github.com/docker/lunchbox/utils"
810
)
911

1012
// Extract extracts the app content if argument is an archive, or does nothing if a dir.

packager/init.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func Init(name string, composeFiles []string) error {
1919
if err := utils.ValidateAppName(name); err != nil {
2020
return err
2121
}
22-
dirName := utils.DirnameFromAppName(name)
22+
dirName := utils.DirNameFromAppName(name)
2323
if err := os.Mkdir(dirName, 0755); err != nil {
2424
return err
2525
}
@@ -53,7 +53,7 @@ Examples of possible values: java, mysql, redis, ruby, postgres, rabbitmq...`)
5353
return err
5454
}
5555

56-
dirName := utils.DirnameFromAppName(name)
56+
dirName := utils.DirNameFromAppName(name)
5757
if err := utils.CreateFileWithData(path.Join(dirName, "services.yml"), composeData); err != nil {
5858
return err
5959
}
@@ -63,7 +63,7 @@ Examples of possible values: java, mysql, redis, ruby, postgres, rabbitmq...`)
6363
func initFromComposeFiles(name string, composeFiles []string) error {
6464
log.Println("init from compose")
6565

66-
dirName := utils.DirnameFromAppName(name)
66+
dirName := utils.DirNameFromAppName(name)
6767
composeConfig, err := mergeComposeConfig(composeFiles)
6868
if err != nil {
6969
return err

packager/init_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
package packager
22

33
import (
4-
"github.com/gotestyourself/gotestyourself/assert"
5-
"testing"
4+
"testing"
65

7-
"gopkg.in/yaml.v2"
6+
"github.com/gotestyourself/gotestyourself/assert"
87

9-
"github.com/docker/lunchbox/types"
8+
"github.com/docker/lunchbox/types"
9+
yaml "gopkg.in/yaml.v2"
1010
)
1111

1212
func TestComposeFileFromScratch(t *testing.T) {
13-
services := []string{
14-
"redis", "mysql", "python",
15-
}
13+
services := []string{
14+
"redis", "mysql", "python",
15+
}
1616

17-
result, err := composeFileFromScratch(services)
18-
assert.NilError(t, err)
17+
result, err := composeFileFromScratch(services)
18+
assert.NilError(t, err)
1919

20-
expected := types.NewInitialComposeFile()
21-
expected.Services = &map[string]types.InitialService{
22-
"redis": {Image: "redis"},
23-
"mysql": {Image: "mysql"},
24-
"python": {Image: "python"},
25-
}
26-
expectedBytes, err := yaml.Marshal(expected)
27-
assert.NilError(t, err)
28-
assert.DeepEqual(t, result, expectedBytes)
20+
expected := types.NewInitialComposeFile()
21+
expected.Services = &map[string]types.InitialService{
22+
"redis": {Image: "redis"},
23+
"mysql": {Image: "mysql"},
24+
"python": {Image: "python"},
25+
}
26+
expectedBytes, err := yaml.Marshal(expected)
27+
assert.NilError(t, err)
28+
assert.DeepEqual(t, result, expectedBytes)
2929
}

utils/components_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package utils
22

33
import (
4-
"github.com/gotestyourself/gotestyourself/assert"
54
"testing"
5+
6+
"github.com/gotestyourself/gotestyourself/assert"
67
)
78

89
func TestMatchService(t *testing.T) {

utils/io_test.go

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

33
import (
4-
"github.com/gotestyourself/gotestyourself/assert"
5-
"github.com/gotestyourself/gotestyourself/fs"
6-
"testing"
4+
"testing"
75

8-
"strings"
6+
"github.com/gotestyourself/gotestyourself/assert"
7+
"github.com/gotestyourself/gotestyourself/fs"
8+
9+
"strings"
910
)
1011

1112
var dummyData = []byte("hello world\n")
1213

1314
func TestCreateFileWithData(t *testing.T) {
14-
tmpdir := fs.NewDir(t, "iotest")
15-
defer tmpdir.Remove()
16-
path := tmpdir.Join("file.txt")
15+
tmpdir := fs.NewDir(t, "iotest")
16+
defer tmpdir.Remove()
17+
path := tmpdir.Join("file.txt")
1718

18-
err := CreateFileWithData(path, dummyData)
19-
assert.NilError(t, err, "failed to write data to file")
19+
err := CreateFileWithData(path, dummyData)
20+
assert.NilError(t, err, "failed to write data to file")
2021

21-
manifest := fs.Expected(t,
22-
fs.WithFile("file.txt", string(dummyData),
23-
fs.WithMode(0644),
24-
),
25-
)
26-
comp := fs.Equal(tmpdir.Path(), manifest)()
27-
assert.Assert(t, comp.Success())
22+
manifest := fs.Expected(t,
23+
fs.WithFile("file.txt", string(dummyData),
24+
fs.WithMode(0644),
25+
),
26+
)
27+
comp := fs.Equal(tmpdir.Path(), manifest)()
28+
assert.Assert(t, comp.Success())
2829
}
2930

3031
func TestCreateFileWithDataOverride(t *testing.T) {
31-
tmpdir := fs.NewDir(t, "iotest")
32-
defer tmpdir.Remove()
33-
path := tmpdir.Join("file.txt")
32+
tmpdir := fs.NewDir(t, "iotest")
33+
defer tmpdir.Remove()
34+
path := tmpdir.Join("file.txt")
3435

35-
err := CreateFileWithData(path, []byte("oops!"))
36-
assert.NilError(t, err, "failed to write data to file")
37-
err = CreateFileWithData(path, dummyData)
38-
assert.NilError(t, err, "failed to rewrite data to file")
36+
err := CreateFileWithData(path, []byte("oops!"))
37+
assert.NilError(t, err, "failed to write data to file")
38+
err = CreateFileWithData(path, dummyData)
39+
assert.NilError(t, err, "failed to rewrite data to file")
3940

40-
manifest := fs.Expected(t,
41-
fs.WithFile("file.txt", string(dummyData),
42-
fs.WithMode(0644),
43-
),
44-
)
45-
comp := fs.Equal(tmpdir.Path(), manifest)()
46-
assert.Assert(t, comp.Success())
41+
manifest := fs.Expected(t,
42+
fs.WithFile("file.txt", string(dummyData),
43+
fs.WithMode(0644),
44+
),
45+
)
46+
comp := fs.Equal(tmpdir.Path(), manifest)()
47+
assert.Assert(t, comp.Success())
4748
}
4849

4950
func TestReadNewlineSeparatedList(t *testing.T) {
50-
reader := strings.NewReader("lorem\nipsum\r\ndolor sit\namet\n")
51-
results, err := ReadNewlineSeparatedList(reader)
52-
assert.NilError(t, err)
53-
expected := []string{
54-
"lorem", "ipsum", "dolor sit", "amet",
55-
}
56-
assert.DeepEqual(t, results, expected)
51+
reader := strings.NewReader("lorem\nipsum\r\ndolor sit\namet\n")
52+
results, err := ReadNewlineSeparatedList(reader)
53+
assert.NilError(t, err)
54+
expected := []string{
55+
"lorem", "ipsum", "dolor sit", "amet",
56+
}
57+
assert.DeepEqual(t, results, expected)
5758
}
5859

5960
func TestReadNewlineSeparatedListWithEmptyLines(t *testing.T) {
60-
reader := strings.NewReader("\t\t\nlorem\n\nipsum\n \ndolor sit\r\n\n\namet\n ")
61-
results, err := ReadNewlineSeparatedList(reader)
62-
assert.NilError(t, err)
63-
expected := []string{
64-
"lorem", "ipsum", "dolor sit", "amet",
65-
}
66-
assert.DeepEqual(t, results, expected)
61+
reader := strings.NewReader("\t\t\nlorem\n\nipsum\n \ndolor sit\r\n\n\namet\n ")
62+
results, err := ReadNewlineSeparatedList(reader)
63+
assert.NilError(t, err)
64+
expected := []string{
65+
"lorem", "ipsum", "dolor sit", "amet",
66+
}
67+
assert.DeepEqual(t, results, expected)
6768
}
6869

6970
func TestReadNewlineSeparatedListSanitize(t *testing.T) {
70-
reader := strings.NewReader("\t\tlorem\nipsum\n\t\t\ndolor sit \n \t amet \t\r\r\n")
71-
results, err := ReadNewlineSeparatedList(reader)
72-
assert.NilError(t, err)
73-
expected := []string{
74-
"lorem", "ipsum", "dolor sit", "amet",
75-
}
76-
assert.DeepEqual(t, results, expected)
71+
reader := strings.NewReader("\t\tlorem\nipsum\n\t\t\ndolor sit \n \t amet \t\r\r\n")
72+
results, err := ReadNewlineSeparatedList(reader)
73+
assert.NilError(t, err)
74+
expected := []string{
75+
"lorem", "ipsum", "dolor sit", "amet",
76+
}
77+
assert.DeepEqual(t, results, expected)
7778
}

utils/names_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ package utils
22

33
import (
44
"fmt"
5-
"github.com/gotestyourself/gotestyourself/assert"
65
"testing"
6+
7+
"github.com/gotestyourself/gotestyourself/assert"
78
)
89

910
func TestValidateAppName(t *testing.T) {

0 commit comments

Comments
 (0)