From d4c58c1a86e6f529d5930ecf3f10cff255000ba0 Mon Sep 17 00:00:00 2001 From: Daniel Nilsson Date: Mon, 23 Jun 2025 12:05:40 +0200 Subject: [PATCH 1/4] removed golang.org/x/exp removed golang.org/x/exp as depenency, and use standard library --- go.mod | 1 - go.sum | 2 -- ldcontext/builder_multi.go | 2 +- ldcontext/builder_simple.go | 2 +- ldcontext/context.go | 2 +- lderrors/context_errors.go | 8 ++++---- ldvalue/value_array.go | 2 +- ldvalue/value_base.go | 2 +- ldvalue/value_map.go | 2 +- 9 files changed, 10 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index fb577f4..31a2f95 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,6 @@ require ( github.com/launchdarkly/go-test-helpers/v3 v3.0.1 github.com/mailru/easyjson v0.7.6 github.com/stretchr/testify v1.7.0 - golang.org/x/exp v0.0.0-20220823124025-807a23277127 ) require ( diff --git a/go.sum b/go.sum index e67be18..23b7e4b 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -golang.org/x/exp v0.0.0-20220823124025-807a23277127 h1:S4NrSKDfihhl3+4jSTgwoIevKxX9p7Iv9x++OEIptDo= -golang.org/x/exp v0.0.0-20220823124025-807a23277127/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/ldcontext/builder_multi.go b/ldcontext/builder_multi.go index 0eba255..2660ea3 100644 --- a/ldcontext/builder_multi.go +++ b/ldcontext/builder_multi.go @@ -5,7 +5,7 @@ import ( "github.com/launchdarkly/go-sdk-common/v3/lderrors" - "golang.org/x/exp/slices" + "slices" ) const defaultMultiBuilderCapacity = 3 // arbitrary value based on presumed likely use cases diff --git a/ldcontext/builder_simple.go b/ldcontext/builder_simple.go index 472f41e..46f24e0 100644 --- a/ldcontext/builder_simple.go +++ b/ldcontext/builder_simple.go @@ -8,7 +8,7 @@ import ( "github.com/launchdarkly/go-sdk-common/v3/lderrors" "github.com/launchdarkly/go-sdk-common/v3/ldvalue" - "golang.org/x/exp/slices" + "slices" ) // Builder is a mutable object that uses the builder pattern to specify properties for a Context. diff --git a/ldcontext/context.go b/ldcontext/context.go index 610c4ed..e99bde5 100644 --- a/ldcontext/context.go +++ b/ldcontext/context.go @@ -8,7 +8,7 @@ import ( "github.com/launchdarkly/go-sdk-common/v3/lderrors" "github.com/launchdarkly/go-sdk-common/v3/ldvalue" - "golang.org/x/exp/slices" + "slices" ) // Context is a collection of attributes that can be referenced in flag evaluations and analytics events. diff --git a/lderrors/context_errors.go b/lderrors/context_errors.go index bd140ce..f0ffce2 100644 --- a/lderrors/context_errors.go +++ b/lderrors/context_errors.go @@ -2,10 +2,10 @@ package lderrors import ( "fmt" - "sort" + "slices" "strings" - "golang.org/x/exp/maps" + "maps" ) const ( @@ -83,8 +83,8 @@ func (e ErrContextKindMultiDuplicates) Error() string { return msgContextKind func (e ErrContextKindInvalidChars) Error() string { return msgContextKindInvalidChars } func (e ErrContextPerKindErrors) Error() string { - sortedKeys := maps.Keys(e.Errors) - sort.Strings(sortedKeys) + sortedKeys := slices.Sorted(maps.Keys(e.Errors)) + messages := make([]string, 0, len(e.Errors)) for _, kind := range sortedKeys { messages = append(messages, fmt.Sprintf("(%s) %s", kind, e.Errors[kind])) diff --git a/ldvalue/value_array.go b/ldvalue/value_array.go index a6a43ef..e50c12a 100644 --- a/ldvalue/value_array.go +++ b/ldvalue/value_array.go @@ -1,7 +1,7 @@ package ldvalue import ( - "golang.org/x/exp/slices" + "slices" ) // we reuse this for all non-nil zero-length ValueArray instances diff --git a/ldvalue/value_base.go b/ldvalue/value_base.go index 3fb039b..a08aeae 100644 --- a/ldvalue/value_base.go +++ b/ldvalue/value_base.go @@ -3,7 +3,7 @@ package ldvalue import ( "encoding/json" - "golang.org/x/exp/slices" + "slices" ) // Value represents any of the data types supported by JSON, all of which can be used for a LaunchDarkly diff --git a/ldvalue/value_map.go b/ldvalue/value_map.go index 4923cfe..0788bf7 100644 --- a/ldvalue/value_map.go +++ b/ldvalue/value_map.go @@ -1,7 +1,7 @@ package ldvalue import ( - "golang.org/x/exp/maps" + "maps" ) // we reuse this for all non-nil zero-length ValueMap instances From 3d9d7db0da28aa2794403548edff51091716d25f Mon Sep 17 00:00:00 2001 From: Daniel Nilsson Date: Mon, 23 Jun 2025 12:08:27 +0200 Subject: [PATCH 2/4] bump go version to 1.24 --- .github/variables/go-versions.env | 2 +- README.md | 2 +- go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/variables/go-versions.env b/.github/variables/go-versions.env index 843e5c4..c80ac7c 100644 --- a/.github/variables/go-versions.env +++ b/.github/variables/go-versions.env @@ -1,3 +1,3 @@ -latest=1.23 +latest=1.24 penultimate=1.22 min=1.18 diff --git a/README.md b/README.md index 00adc15..7e84956 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Applications using the LaunchDarkly Go SDK will generally use the `ldcontext` su ## Supported Go versions -This version of the project requires a Go version of 1.18 or higher. +This version of the project requires a Go version of 1.24 or higher. ## Integration with easyjson diff --git a/go.mod b/go.mod index 31a2f95..81b7f87 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/launchdarkly/go-sdk-common/v3 -go 1.18 +go 1.24 require ( github.com/launchdarkly/go-jsonstream/v3 v3.0.0 From 2da9c577abf23f414603a9180b6a01a68990fe05 Mon Sep 17 00:00:00 2001 From: Daniel Nilsson Date: Fri, 27 Jun 2025 09:48:08 +0200 Subject: [PATCH 3/4] penultimate and min go version updated minimum 1.23 --- .github/variables/go-versions.env | 4 ++-- README.md | 2 +- go.mod | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/variables/go-versions.env b/.github/variables/go-versions.env index c80ac7c..cb4024a 100644 --- a/.github/variables/go-versions.env +++ b/.github/variables/go-versions.env @@ -1,3 +1,3 @@ latest=1.24 -penultimate=1.22 -min=1.18 +penultimate=1.23 +min=1.23 diff --git a/README.md b/README.md index 7e84956..e1ea679 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Applications using the LaunchDarkly Go SDK will generally use the `ldcontext` su ## Supported Go versions -This version of the project requires a Go version of 1.24 or higher. +This version of the project requires a Go version of 1.23 or higher. ## Integration with easyjson diff --git a/go.mod b/go.mod index 81b7f87..0771af7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/launchdarkly/go-sdk-common/v3 -go 1.24 +go 1.23 require ( github.com/launchdarkly/go-jsonstream/v3 v3.0.0 From 2b85b6a5319b04d15d4cd0ed884903c98a8fd777 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Tue, 8 Jul 2025 09:44:19 -0400 Subject: [PATCH 4/4] Bump version --- Makefile | 3 +-- ldtime/unix_millis.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0438299..30c7638 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ - -GOLANGCI_LINT_VERSION=v1.60.1 +GOLANGCI_LINT_VERSION=v1.64.5 LINTER=./bin/golangci-lint LINTER_VERSION_FILE=./bin/.golangci-lint-version-$(GOLANGCI_LINT_VERSION) diff --git a/ldtime/unix_millis.go b/ldtime/unix_millis.go index f1dbbe4..a1e61f3 100644 --- a/ldtime/unix_millis.go +++ b/ldtime/unix_millis.go @@ -8,7 +8,7 @@ type UnixMillisecondTime uint64 // UnixMillisFromTime converts a Time value into UnixMillisecondTime. func UnixMillisFromTime(t time.Time) UnixMillisecondTime { ms := time.Duration(t.UnixNano()) / time.Millisecond - return UnixMillisecondTime(ms) + return UnixMillisecondTime(ms) //nolint:gosec } // UnixMillisNow returns the current date/time as a UnixMillisecondTime.