Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Go runtime to 1.21.3 #1102

Merged
merged 5 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.20.7
1.21.3
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bugfixes

* Update Go runtime to 1.21.3. [#1102](https://github.com/elastic/package-registry/pull/1102)

### Added

### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# It expects packages to be mounted under /packages/package-registry or have a config file loaded into /package-registry/config.yml

# Build binary
ARG GO_VERSION=1.20.7
ARG GO_VERSION=1.21.3
FROM golang:${GO_VERSION} AS builder

COPY ./ /package-registry
Expand Down
3 changes: 2 additions & 1 deletion categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
"slices"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -194,7 +195,7 @@ func getCategories(ctx context.Context, pkgs packages.Packages, includePolicyTem
}
}

if !p.HasCategory(c) && !util.StringsContains(extraPackageCategories, c) {
if !p.HasCategory(c) && !slices.Contains(extraPackageCategories, c) {
extraPackageCategories = append(extraPackageCategories, c)
categories[c].Count = categories[c].Count + 1
}
Expand Down
15 changes: 0 additions & 15 deletions internal/util/strings.go

This file was deleted.

8 changes: 4 additions & 4 deletions packages/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"os"
"path"
"slices"
"strings"

"github.com/Masterminds/semver/v3"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/elastic/go-ucfg/yaml"

"github.com/elastic/package-registry/categories"
"github.com/elastic/package-registry/internal/util"
)

const (
Expand Down Expand Up @@ -382,7 +382,7 @@ func (p *Package) HasPolicyTemplateWithCategory(category string) bool {
}

func hasCategory(categories []string, category string) bool {
if util.StringsContains(categories, category) {
if slices.Contains(categories, category) {
return true
}

Expand All @@ -392,7 +392,7 @@ func hasCategory(categories []string, category string) bool {
continue
}

if util.StringsContains(categories, subcategory.Name) {
if slices.Contains(categories, subcategory.Name) {
return true
}
}
Expand All @@ -414,7 +414,7 @@ func (p *Package) WorksWithCapabilities(capabilities []string) bool {
}

for _, requiredCapability := range p.Conditions.Elastic.Capabilities {
if !util.StringsContains(capabilities, requiredCapability) {
if !slices.Contains(capabilities, requiredCapability) {
return false
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"os"
"path/filepath"
"slices"
"strings"
"time"

Expand All @@ -19,7 +20,6 @@ import (
"go.elastic.co/apm/v2"
"go.uber.org/zap"

"github.com/elastic/package-registry/internal/util"
"github.com/elastic/package-registry/metrics"
)

Expand Down Expand Up @@ -504,7 +504,7 @@ func filterPolicyTemplates(p Package, category string) *Package {
var updatedPolicyTemplates []PolicyTemplate
var updatedBasePolicyTemplates []BasePolicyTemplate
for i, pt := range p.PolicyTemplates {
if util.StringsContains(pt.Categories, category) {
if slices.Contains(pt.Categories, category) {
updatedPolicyTemplates = append(updatedPolicyTemplates, pt)
updatedBasePolicyTemplates = append(updatedBasePolicyTemplates, p.BasePackage.BasePolicyTemplates[i])
}
Expand Down