Skip to content

Commit

Permalink
removing version from DC file
Browse files Browse the repository at this point in the history
  • Loading branch information
awlawl committed Feb 24, 2023
1 parent 6f8999a commit 96acaa7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions dockercompose/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func New(file string) ComposeFile {
result := ComposeFile{
File: file,
Data: DockerCompose{
Version: "3.7",
Services: make(map[string]*Service),
},
}
Expand Down Expand Up @@ -65,8 +64,8 @@ func (composeFile *ComposeFile) Read() error {
if err != nil {
return fmt.Errorf("unmarshalling docker compose yaml: %w", err)
}
if compose.Version == "" || len(compose.Services) == 0 {
return errors.New("unable to parse compose file")
if len(compose.Services) == 0 {
return errors.New("unable to parse compose file, no services found")
}
composeFile.Data = compose
return nil
Expand Down
2 changes: 0 additions & 2 deletions dockercompose/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

// DockerCompose represents a docker-compose.yml file
type DockerCompose struct {
Version string `yaml:"version"`
Services map[string]*Service `yaml:"services"`
}

Expand Down Expand Up @@ -58,7 +57,6 @@ func UnmarshalComposeYAML(yamlBytes []byte) (DockerCompose, error) {
if err == nil {

//copy data from short types to result types
result.Version = short.Version
result.Services = make(map[string]*Service, len(short.Services))
for s, svc := range short.Services {

Expand Down

0 comments on commit 96acaa7

Please sign in to comment.