From a440c501e53aa07ab6c98521d8579c287aaf5ec0 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Tue, 12 Nov 2024 09:43:35 -0500 Subject: [PATCH] Re-add support for go 1.22 --- .github/workflows/ci.yml | 2 +- dates/i18n.go | 5 ++--- go.mod | 2 +- httpx/mock.go | 5 ++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12d114f..3b321f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go-version: [1.23.x] + go-version: [1.22.x, 1.23.x] services: redis: diff --git a/dates/i18n.go b/dates/i18n.go index d6000e6..4007d84 100644 --- a/dates/i18n.go +++ b/dates/i18n.go @@ -2,11 +2,10 @@ package dates import ( _ "embed" - "maps" - "slices" "github.com/nyaruka/gocommon/i18n" "github.com/nyaruka/gocommon/jsonx" + "golang.org/x/exp/maps" ) // File containing day and month translations, generated using https://github.com/nyaruka/go-locales @@ -31,7 +30,7 @@ var defaultLocale = "en_US" func init() { jsonx.MustUnmarshal(i18nJSON, &translations) - bcp47Matcher = i18n.NewBCP47Matcher(slices.Collect(maps.Keys(translations))...) + bcp47Matcher = i18n.NewBCP47Matcher(maps.Keys(translations)...) // not all locales have AM/PM values.. but it's simpler if we just given them a default for _, trans := range translations { diff --git a/go.mod b/go.mod index 6407337..f685d86 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nyaruka/gocommon -go 1.23 +go 1.22.0 require ( github.com/aws/aws-sdk-go-v2 v1.32.4 diff --git a/httpx/mock.go b/httpx/mock.go index 67a8e61..c794ef0 100644 --- a/httpx/mock.go +++ b/httpx/mock.go @@ -6,12 +6,11 @@ import ( "errors" "fmt" "io" - "maps" "net/http" - "slices" "github.com/nyaruka/gocommon/jsonx" "github.com/nyaruka/gocommon/stringsx" + "golang.org/x/exp/maps" ) // MockRequestor is a requestor which can be mocked with responses for given URLs @@ -43,7 +42,7 @@ func (r *MockRequestor) Do(client *http.Client, request *http.Request) (*http.Re url := request.URL.String() // find the most specific match against this URL - match := stringsx.GlobSelect(url, slices.Collect(maps.Keys(r.mocks))...) + match := stringsx.GlobSelect(url, maps.Keys(r.mocks)...) mockedResponses := r.mocks[match] if len(mockedResponses) == 0 {