Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pkg/compose/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,13 @@ func (s *composeService) checkEnvironmentVariables(project *types.Project, optio
if !options.WithEnvironment && len(errorList) > 0 {
errorMsgSuffix := "To avoid leaking sensitive data, you must either explicitly allow the sending of environment variables by using the --with-env flag,\n" +
"or remove sensitive data from your Compose configuration"
errorMsg := ""
var errorMsg strings.Builder
for _, errors := range errorList {
for _, err := range errors {
errorMsg += fmt.Sprintf("%s\n", err)
errorMsg.WriteString(fmt.Sprintf("%s\n", err))
}
}
return nil, fmt.Errorf("%s%s", errorMsg, errorMsgSuffix)
return nil, fmt.Errorf("%s%s", errorMsg.String(), errorMsgSuffix)

}
return envVarList, nil
Expand Down Expand Up @@ -422,11 +422,12 @@ func (s *composeService) checkOnlyBuildSection(project *types.Project) (bool, er
}
}
if len(errorList) > 0 {
errMsg := "your Compose stack cannot be published as it only contains a build section for service(s):\n"
var errMsg strings.Builder
errMsg.WriteString("your Compose stack cannot be published as it only contains a build section for service(s):\n")
for _, serviceInError := range errorList {
errMsg += fmt.Sprintf("- %q\n", serviceInError)
errMsg.WriteString(fmt.Sprintf("- %q\n", serviceInError))
}
return false, errors.New(errMsg)
return false, errors.New(errMsg.String())
}
return true, nil
}
Expand Down