Skip to content

Commit

Permalink
fix WithProfiles to return a project wih Profiles set
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof committed Mar 21, 2024
1 parent f0d27fc commit 2697b9c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions types/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ func (s ServiceConfig) HasProfile(profiles []string) bool {
return true
}
for _, p := range profiles {
if p == "*" {
return true
}
for _, sp := range s.Profiles {
if sp == p {
return true
Expand All @@ -345,11 +348,6 @@ func (s ServiceConfig) HasProfile(profiles []string) bool {
// It returns a new Project instance with the changes and keep the original Project unchanged
func (p *Project) WithProfiles(profiles []string) (*Project, error) {
newProject := p.deepCopy()
for _, p := range profiles {
if p == "*" {
return newProject, nil
}
}
enabled := Services{}
disabled := Services{}
for name, service := range newProject.AllServices() {
Expand Down

0 comments on commit 2697b9c

Please sign in to comment.