happy shinny linter ☜(⌒▽⌒)☞

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-02-12 10:19:26 +01:00
parent 49415afe5d
commit 15882d3503
3 changed files with 10 additions and 8 deletions

View File

@ -18,9 +18,11 @@ package compose
import (
"context"
"github.com/docker/compose-cli/api/client"
"github.com/docker/compose-cli/api/compose"
"github.com/docker/compose-cli/api/progress"
"github.com/spf13/cobra"
)

View File

@ -19,7 +19,6 @@ package compose
import (
"context"
"fmt"
"golang.org/x/sync/errgroup"
"os"
"os/signal"
"path/filepath"
@ -37,6 +36,7 @@ import (
"github.com/compose-spec/compose-go/types"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/sync/errgroup"
)
// composeOptions hold options common to `up` and `run` to run compose project
@ -223,7 +223,7 @@ func runCreateStart(ctx context.Context, opts upOptions, services []string) erro
return err
}
eg.Wait()
err = eg.Wait()
if exitCode != 0 {
return cmd.ExitCodeError{ExitCode: exitCode}
}

View File

@ -30,7 +30,7 @@ import (
func NewLogConsumer(ctx context.Context, w io.Writer, color bool, prefix bool) compose.LogConsumer {
return &logConsumer{
ctx: ctx,
presenters: map[string]*Presenter{},
presenters: map[string]*presenter{},
width: 0,
writer: w,
color: color,
@ -42,12 +42,12 @@ func (l *logConsumer) Register(service string, source string) {
l.register(service, source)
}
func (l *logConsumer) register(service string, source string) *Presenter {
func (l *logConsumer) register(service string, source string) *presenter {
cf := monochrome
if l.color {
cf = <-loop
}
p := &Presenter{
p := &presenter{
colors: cf,
service: service,
container: source,
@ -98,20 +98,20 @@ func (l *logConsumer) computeWidth() {
// LogConsumer consume logs from services and format them
type logConsumer struct {
ctx context.Context
presenters map[string]*Presenter
presenters map[string]*presenter
width int
writer io.Writer
color bool
prefix bool
}
type Presenter struct {
type presenter struct {
colors colorFunc
service string
container string
prefix string
}
func (p *Presenter) setPrefix(width int) {
func (p *presenter) setPrefix(width int) {
p.prefix = p.colors(fmt.Sprintf("%-"+strconv.Itoa(width)+"s |", p.container))
}