Skip to content

Commit

Permalink
Update to go 1.23
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 9, 2024
1 parent bc94d8e commit 176c170
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CI
on: [push, pull_request]
env:
go-version: "1.22.x"
go-version: "1.23.x"
jobs:
test:
name: Test
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/nyaruka/courier

go 1.22
go 1.23

require (
github.com/antchfx/xmlquery v1.4.1
Expand All @@ -24,7 +24,6 @@ require (
github.com/samber/slog-multi v1.2.0
github.com/samber/slog-sentry v1.2.2
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/mod v0.19.0
golang.org/x/oauth2 v0.21.0
gopkg.in/go-playground/validator.v9 v9.31.0
Expand Down Expand Up @@ -70,6 +69,7 @@ require (
github.com/samber/lo v1.45.0 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
Expand Down
9 changes: 4 additions & 5 deletions handlers/meta/whatsapp/templates.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package whatsapp

import (
"sort"
"maps"
"slices"
"strings"

"github.com/nyaruka/courier"
"github.com/nyaruka/courier/handlers"
"golang.org/x/exp/maps"
)

func GetTemplatePayload(templating *courier.Templating) *Template {
Expand All @@ -19,9 +19,8 @@ func GetTemplatePayload(templating *courier.Templating) *Template {
for _, comp := range templating.Components {
// get the variables used by this component in order of their names 1, 2 etc
compParams := make([]courier.TemplatingVariable, 0, len(comp.Variables))
varNames := maps.Keys(comp.Variables)
sort.Strings(varNames)
for _, varName := range varNames {

for _, varName := range slices.Sorted(maps.Keys(comp.Variables)) {
compParams = append(compParams, templating.Variables[comp.Variables[varName]])
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package handlers

import (
"bytes"
"slices"
"strings"

"github.com/nyaruka/courier"
"golang.org/x/exp/slices"
)

type MsgPartType int
Expand Down
9 changes: 4 additions & 5 deletions handlers/whatsapp_legacy/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"errors"
"fmt"
"log/slog"
"maps"
"net/http"
"net/url"
"sort"
"slices"
"strconv"
"strings"
"time"
Expand All @@ -25,7 +26,6 @@ import (
"github.com/nyaruka/gocommon/urns"
"github.com/nyaruka/redisx"
"github.com/patrickmn/go-cache"
"golang.org/x/exp/maps"
"golang.org/x/mod/semver"
)

Expand Down Expand Up @@ -720,9 +720,8 @@ func buildPayloads(msg courier.MsgOut, h *handler, clog *courier.ChannelLog) ([]
for _, comp := range msg.Templating().Components {
// get the variables used by this component in order of their names 1, 2 etc
compParams := make([]courier.TemplatingVariable, 0, len(comp.Variables))
varNames := maps.Keys(comp.Variables)
sort.Strings(varNames)
for _, varName := range varNames {

for _, varName := range slices.Sorted(maps.Keys(comp.Variables)) {
compParams = append(compParams, msg.Templating().Variables[comp.Variables[varName]])
}

Expand Down

0 comments on commit 176c170

Please sign in to comment.