mirror of
https://github.com/docker/compose.git
synced 2025-07-26 07:04:32 +02:00
Fix linter
This commit is contained in:
parent
df6fc2f18f
commit
f3f6bff583
@ -49,13 +49,19 @@ func Columns(line string) []string {
|
|||||||
return filter.Choose(strings.Split(line, " "), nonEmptyString).([]string)
|
return filter.Choose(strings.Split(line, " "), nonEmptyString).([]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GoldenFile golden file specific to platform
|
||||||
func GoldenFile(name string) string {
|
func GoldenFile(name string) string {
|
||||||
if runtime.GOOS == "windows" {
|
if IsWindows() {
|
||||||
return name + "-windows.golden"
|
return name + "-windows.golden"
|
||||||
}
|
}
|
||||||
return name + ".golden"
|
return name + ".golden"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsWindows windows or other GOOS
|
||||||
|
func IsWindows() bool {
|
||||||
|
return runtime.GOOS == "windows"
|
||||||
|
}
|
||||||
|
|
||||||
// It runs func
|
// It runs func
|
||||||
func It(description string, test func()) {
|
func It(description string, test func()) {
|
||||||
test()
|
test()
|
||||||
|
@ -33,7 +33,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
@ -56,6 +55,7 @@ func (s *Suite) SetupSuite() {
|
|||||||
log.Error(message)
|
log.Error(message)
|
||||||
cp := filepath.Join(s.ConfigDir, "config.json")
|
cp := filepath.Join(s.ConfigDir, "config.json")
|
||||||
d, _ := ioutil.ReadFile(cp)
|
d, _ := ioutil.ReadFile(cp)
|
||||||
|
fmt.Printf("Bin dir:%s\n", s.BinDir)
|
||||||
fmt.Printf("Contents of %s:\n%s\n\nContents of config dir:\n", cp, string(d))
|
fmt.Printf("Contents of %s:\n%s\n\nContents of config dir:\n", cp, string(d))
|
||||||
for _, p := range dirContents(s.ConfigDir) {
|
for _, p := range dirContents(s.ConfigDir) {
|
||||||
fmt.Println(p)
|
fmt.Println(p)
|
||||||
@ -85,23 +85,23 @@ func (s *Suite) copyExecutablesInBinDir() {
|
|||||||
p, err = exec.LookPath(dockerExecutable())
|
p, err = exec.LookPath(dockerExecutable())
|
||||||
}
|
}
|
||||||
gomega.Expect(err).To(gomega.BeNil())
|
gomega.Expect(err).To(gomega.BeNil())
|
||||||
err = copyFiles(p, filepath.Join(s.BinDir, DockerClassicExecutable()))
|
err = copyFile(p, filepath.Join(s.BinDir, DockerClassicExecutable()))
|
||||||
gomega.Expect(err).To(gomega.BeNil())
|
gomega.Expect(err).To(gomega.BeNil())
|
||||||
dockerPath, err := filepath.Abs("../../bin/" + dockerExecutable())
|
dockerPath, err := filepath.Abs("../../bin/" + dockerExecutable())
|
||||||
gomega.Expect(err).To(gomega.BeNil())
|
gomega.Expect(err).To(gomega.BeNil())
|
||||||
err = copyFiles(dockerPath, filepath.Join(s.BinDir, dockerExecutable()))
|
err = copyFile(dockerPath, filepath.Join(s.BinDir, dockerExecutable()))
|
||||||
gomega.Expect(err).To(gomega.BeNil())
|
gomega.Expect(err).To(gomega.BeNil())
|
||||||
err = os.Setenv("PATH", fmt.Sprintf("%s:%s", s.BinDir, os.Getenv("PATH")))
|
err = os.Setenv("PATH", fmt.Sprintf("%s:%s", s.BinDir, os.Getenv("PATH")))
|
||||||
gomega.Expect(err).To(gomega.BeNil())
|
gomega.Expect(err).To(gomega.BeNil())
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyFiles(sourceFile string, destinationFile string) error {
|
func copyFile(sourceFile string, destinationFile string) error {
|
||||||
input, err := ioutil.ReadFile(sourceFile)
|
input, err := ioutil.ReadFile(sourceFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(destinationFile, input, 0644)
|
err = ioutil.WriteFile(destinationFile, input, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -128,10 +128,6 @@ func (s *Suite) ListProcessesCommand() *CmdContext {
|
|||||||
return s.NewCommand("ps")
|
return s.NewCommand("ps")
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsWindows() bool {
|
|
||||||
return runtime.GOOS == "windows"
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewCommand creates a command context.
|
// NewCommand creates a command context.
|
||||||
func (s *Suite) NewCommand(command string, args ...string) *CmdContext {
|
func (s *Suite) NewCommand(command string, args ...string) *CmdContext {
|
||||||
return &CmdContext{
|
return &CmdContext{
|
||||||
@ -148,6 +144,7 @@ func dockerExecutable() string {
|
|||||||
return "docker"
|
return "docker"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DockerClassicExecutable binary name based on platform
|
||||||
func DockerClassicExecutable() string {
|
func DockerClassicExecutable() string {
|
||||||
if IsWindows() {
|
if IsWindows() {
|
||||||
return "docker-classic.exe"
|
return "docker-classic.exe"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user