Skip to content

Commit 6b427f4

Browse files
authored
Merge branch 'main' into issue-12657
Signed-off-by: Suleiman Dibirov <3595194+idsulik@users.noreply.github.com>
2 parents 67100e9 + c7613e2 commit 6b427f4

File tree

9 files changed

+17
-21
lines changed

9 files changed

+17
-21
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ require (
1414
github.com/stretchr/testify v1.8.4
1515
github.com/xeipuuv/gojsonschema v1.2.0
1616
github.com/xhit/go-str2duration/v2 v2.1.0
17-
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3
1817
golang.org/x/sync v0.3.0
1918
gopkg.in/yaml.v3 v3.0.1
2019
gotest.tools/v3 v3.4.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
3737
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
3838
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
3939
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
40-
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o=
41-
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
4240
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
4341
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
4442
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=

graph/cycle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ package graph
1818

1919
import (
2020
"fmt"
21+
"slices"
2122
"strings"
2223

2324
"github.com/compose-spec/compose-go/v2/types"
2425
"github.com/compose-spec/compose-go/v2/utils"
25-
"golang.org/x/exp/slices"
2626
)
2727

2828
// CheckCycle analyze project's depends_on relation and report an error on cycle detection

graph/traversal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ package graph
1818

1919
import (
2020
"context"
21+
"slices"
2122
"sync"
2223

23-
"golang.org/x/exp/slices"
2424
"golang.org/x/sync/errgroup"
2525
)
2626

loader/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"path/filepath"
2727
"reflect"
2828
"regexp"
29+
"slices"
2930
"strconv"
3031
"strings"
3132

@@ -42,7 +43,6 @@ import (
4243
"github.com/compose-spec/compose-go/v2/validation"
4344
"github.com/go-viper/mapstructure/v2"
4445
"github.com/sirupsen/logrus"
45-
"golang.org/x/exp/slices"
4646
"gopkg.in/yaml.v3"
4747
)
4848

override/merge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ package override
1919
import (
2020
"cmp"
2121
"fmt"
22+
"slices"
2223
"strings"
2324

2425
"github.com/compose-spec/compose-go/v2/tree"
25-
"golang.org/x/exp/slices"
2626
)
2727

2828
// Merge applies overrides to a config model

types/project.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ import (
2121
"context"
2222
"encoding/json"
2323
"fmt"
24+
"maps"
2425
"os"
2526
"path/filepath"
27+
"slices"
2628
"sort"
2729

2830
"github.com/compose-spec/compose-go/v2/dotenv"
2931
"github.com/compose-spec/compose-go/v2/errdefs"
3032
"github.com/compose-spec/compose-go/v2/utils"
3133
"github.com/distribution/reference"
3234
godigest "github.com/opencontainers/go-digest"
33-
"golang.org/x/exp/maps"
3435
"golang.org/x/sync/errgroup"
3536
"gopkg.in/yaml.v3"
3637
)
@@ -120,21 +121,21 @@ func (p *Project) ServicesWithBuild() []string {
120121
servicesBuild := p.Services.Filter(func(s ServiceConfig) bool {
121122
return s.Build != nil && s.Build.Context != ""
122123
})
123-
return maps.Keys(servicesBuild)
124+
return slices.Collect(maps.Keys(servicesBuild))
124125
}
125126

126127
func (p *Project) ServicesWithExtends() []string {
127128
servicesExtends := p.Services.Filter(func(s ServiceConfig) bool {
128129
return s.Extends != nil && *s.Extends != (ExtendsConfig{})
129130
})
130-
return maps.Keys(servicesExtends)
131+
return slices.Collect(maps.Keys(servicesExtends))
131132
}
132133

133134
func (p *Project) ServicesWithDependsOn() []string {
134135
servicesDependsOn := p.Services.Filter(func(s ServiceConfig) bool {
135136
return len(s.DependsOn) > 0
136137
})
137-
return maps.Keys(servicesDependsOn)
138+
return slices.Collect(maps.Keys(servicesDependsOn))
138139
}
139140

140141
func (p *Project) ServicesWithCapabilities() ([]string, []string, []string) {

types/project_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import (
2121
"errors"
2222
"fmt"
2323
"sort"
24+
"slices"
2425
"strings"
2526
"testing"
2627

2728
"github.com/compose-spec/compose-go/v2/utils"
2829
"github.com/distribution/reference"
2930
"github.com/opencontainers/go-digest"
30-
"golang.org/x/exp/slices"
3131
"gotest.tools/v3/assert"
3232
)
3333

@@ -296,13 +296,13 @@ func TestWithServicesWithWildcard(t *testing.T) {
296296

297297
func TestServicesWithBuild(t *testing.T) {
298298
p := makeProject()
299-
assert.DeepEqual(t, []string{}, p.ServicesWithBuild())
299+
assert.Equal(t, len(p.ServicesWithBuild()), 0)
300300

301301
service, err := p.GetService("service_1")
302302
assert.NilError(t, err)
303303
service.Build = &BuildConfig{}
304304
p.Services["service_1"] = service
305-
assert.DeepEqual(t, []string{}, p.ServicesWithBuild())
305+
assert.Equal(t, len(p.ServicesWithBuild()), 0)
306306

307307
service.Build = &BuildConfig{
308308
Context: ".",

utils/collectionutils.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717
package utils
1818

1919
import (
20-
"golang.org/x/exp/constraints"
21-
"golang.org/x/exp/maps"
22-
"golang.org/x/exp/slices"
20+
"cmp"
21+
"maps"
22+
"slices"
2323
)
2424

25-
func MapKeys[T constraints.Ordered, U any](theMap map[T]U) []T {
26-
result := maps.Keys(theMap)
27-
slices.Sort(result)
28-
return result
25+
func MapKeys[T cmp.Ordered, U any](theMap map[T]U) []T {
26+
return slices.Sorted(maps.Keys(theMap))
2927
}
3028

3129
func MapsAppend[T comparable, U any](target map[T]U, source map[T]U) map[T]U {

0 commit comments

Comments
 (0)