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

Commit 4748e8f

Browse files
committed
fixes to get tests passing for compose >2.x support (yml parsing)
Signed-off-by: Nathan Sullivan <[email protected]>
1 parent cfb957a commit 4748e8f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

config/merge.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ var (
2828
)
2929

3030
func getComposeMajorVersion(version string) (int, error) {
31-
return strconv.Atoi(strings.Split(version, ".")[0])
31+
if version == "" {
32+
return 1, nil
33+
}
34+
parts := strings.Split(version, ".")
35+
if len(parts) == 1 {
36+
return strconv.Atoi(version)
37+
} else if len(parts) == 2 {
38+
return strconv.Atoi(parts[0])
39+
} else {
40+
return -1, fmt.Errorf("Invalid version string, expected single integer or dot delimited int.int. Got: %s", version)
41+
}
3242
}
3343

3444
// CreateConfig unmarshals bytes of a YAML manifest file and returns a new

0 commit comments

Comments
 (0)