Skip to content

Commit

Permalink
ci: tweak restricted imports in linter
Browse files Browse the repository at this point in the history
Signed-off-by: Milas Bowman <[email protected]>
  • Loading branch information
milas committed Sep 11, 2023
1 parent 1311546 commit 4c33b8f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ linters-settings:
deny:
- pkg: io/ioutil
desc: 'io/ioutil package has been deprecated'
- pkg: gopkg.in/yaml.v2
desc: 'compose-go uses yaml.v3'
gomodguard:
blocked:
versions:
- github.com/distribution/distribution:
reason: "use distribution/reference"
- gotest.tools:
version: "< 3.0.0"
reason: "deprecated, pre-modules version"
Expand All @@ -61,5 +65,3 @@ issues:
# golangci hides some golint warnings (the warning about exported things
# withtout documentation for example), this will make it show them anyway.
exclude-use-default: false
exclude:
- should not use dot imports
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ require (
go.uber.org/goleak v1.2.1
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.57.0
gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.5.0
)

Expand Down Expand Up @@ -172,6 +171,7 @@ require (
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.26.2 // indirect
k8s.io/apimachinery v0.26.2 // indirect
Expand Down
9 changes: 3 additions & 6 deletions pkg/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package compose

import (
"context"
"encoding/json"
"fmt"
"io"
"os"
Expand All @@ -36,15 +35,13 @@ import (
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/flags"
"github.com/docker/cli/cli/streams"
"github.com/docker/compose/v2/pkg/api"
moby "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/client"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"

"github.com/docker/compose/v2/pkg/api"
)

var stdioToStdout bool
Expand Down Expand Up @@ -169,9 +166,9 @@ func (s *composeService) Config(ctx context.Context, project *types.Project, opt

switch options.Format {
case "json":
return json.MarshalIndent(project, "", " ")
return project.MarshalJSON()

Check warning on line 169 in pkg/compose/compose.go

View check run for this annotation

Codecov / codecov/patch

pkg/compose/compose.go#L169

Added line #L169 was not covered by tests
case "yaml":
return yaml.Marshal(project)
return project.MarshalYAML()
default:
return nil, fmt.Errorf("unsupported format %q", options.Format)
}
Expand Down

0 comments on commit 4c33b8f

Please sign in to comment.