Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit 97d860c

Browse files
committed
fix: cleanups
1 parent 31dcfbe commit 97d860c

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
module github.com/portainer/docker-compose-wrapper
22

3-
go 1.15
3+
go 1.16
4+
5+
require github.com/pkg/errors v0.9.1

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
2+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (wrapper *ComposeWrapper) Command(command composeCommand, workingDir, host,
6868

6969
output, err := cmd.Output()
7070
if err != nil {
71-
return nil, errors.New(stderr.String())
71+
return nil, errors.Wrap(err, stderr.String())
7272
}
7373

7474
return output, nil

wrapper_test.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ services:
7575
t.Fatal(err)
7676
}
7777

78-
_, err = w.Up([]string{filePathOriginal, filePathOverride}, "", "test1", "", "")
78+
_, err = w.Up([]string{filePathOriginal, filePathOverride}, "", "", "test1", "", "")
7979
if err != nil {
8080
t.Fatal(err)
8181
}
@@ -84,7 +84,7 @@ services:
8484
t.Fatal("container should exist")
8585
}
8686

87-
_, err = w.Down([]string{filePathOriginal, filePathOverride}, "", "test1")
87+
_, err = w.Down([]string{filePathOriginal, filePathOverride}, "", "", "test1")
8888
if err != nil {
8989
t.Fatal(err)
9090
}
@@ -94,13 +94,6 @@ services:
9494
}
9595
}
9696

97-
type composeOptions struct {
98-
filePath string
99-
url string
100-
envFile string
101-
projectName string
102-
}
103-
10497
func createFile(dir, fileName, content string) (string, error) {
10598
filePath := filepath.Join(dir, fileName)
10699
f, err := os.Create(filePath)
@@ -114,14 +107,6 @@ func createFile(dir, fileName, content string) (string, error) {
114107
return filePath, nil
115108
}
116109

117-
func createEnvFile(dir, envFileContent string) (string, error) {
118-
return createFile(dir, "stack.env", envFileContent)
119-
}
120-
121-
func createComposeFile(dir, composeFileContent string) (string, error) {
122-
return createFile(dir, "docmer-compose.yml", composeFileContent)
123-
}
124-
125110
func containerExists(containerName string) bool {
126111
cmd := exec.Command("docker", "ps", "-a", "-f", fmt.Sprintf("name=%s", containerName))
127112

0 commit comments

Comments
 (0)