-
Notifications
You must be signed in to change notification settings - Fork 4
feat!: remove easyjson from go-server-sdk-evaluation #51
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| latest=1.26 | ||
| penultimate=1.25 | ||
| min=1.18 | ||
| min=1.24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| package evaluation | ||
|
|
||
| import ( | ||
| "github.com/launchdarkly/go-sdk-common/v3/ldcontext" | ||
| "github.com/launchdarkly/go-sdk-common/v3/ldlog" | ||
| "github.com/launchdarkly/go-sdk-common/v3/ldreason" | ||
| "github.com/launchdarkly/go-sdk-common/v3/ldvalue" | ||
| "github.com/launchdarkly/go-server-sdk-evaluation/v3/ldmodel" | ||
| "github.com/launchdarkly/go-sdk-common/v4/ldcontext" | ||
| "github.com/launchdarkly/go-sdk-common/v4/ldlog" | ||
| "github.com/launchdarkly/go-sdk-common/v4/ldreason" | ||
| "github.com/launchdarkly/go-sdk-common/v4/ldvalue" | ||
| "github.com/launchdarkly/go-server-sdk-evaluation/v4/ldmodel" | ||
| ) | ||
|
|
||
| // Notes on some implementation details in this file: | ||
|
|
@@ -16,10 +16,9 @@ import ( | |
| // nested function/method calls; passing a pointer instead is faster. It is safe for us to do this | ||
| // as long as the pointer value is not being retained outside the scope of this call. | ||
| // | ||
| // - In some for loops, we are deliberately taking the address of the range variable and using a | ||
| // "//nolint:gosec" directive to turn off the usual linter warning about this: | ||
| // - In some for loops, we are deliberately taking the address of the range variable: | ||
| // for _, x := range someThings { | ||
| // doSomething(&x) //nolint:gosec | ||
| // doSomething(&x) | ||
| // } | ||
| // The rationale is the same as above, and is safe as long as the same conditions apply. | ||
|
|
||
|
|
@@ -154,7 +153,7 @@ func (es *evaluationScope) evaluate(stack evaluationStack) (ldreason.EvaluationD | |
|
|
||
| // Now walk through the rules and see if any match | ||
| for ruleIndex, rule := range es.flag.Rules { | ||
| match, err := es.ruleMatchesContext(&rule, stack) //nolint:gosec // see comments at top of file | ||
| match, err := es.ruleMatchesContext(&rule, stack) | ||
| if err != nil { | ||
| es.logEvaluationError(err) | ||
| return ldreason.NewEvaluationDetailForError(errorKindForError(err), ldvalue.Null()), false | ||
|
|
@@ -277,7 +276,7 @@ func (es *evaluationScope) anyTargetMatchVariation() ldvalue.OptionalInt { | |
| // If ContextTargets is empty but Targets is not empty, then this is flag data that originally | ||
| // came from a non-context-aware LD endpoint or SDK. In that case, just look at Targets. | ||
| for _, t := range es.flag.Targets { | ||
| if variation := es.targetMatchVariation(&t); variation.IsDefined() { //nolint:gosec // see comments at top of file | ||
| if variation := es.targetMatchVariation(&t); variation.IsDefined() { | ||
| return variation | ||
| } | ||
| } | ||
|
|
@@ -289,12 +288,12 @@ func (es *evaluationScope) anyTargetMatchVariation() ldvalue.OptionalInt { | |
| if (t.ContextKind == "" || t.ContextKind == ldcontext.DefaultKind) && len(t.Values) == 0 { | ||
| for _, t1 := range es.flag.Targets { | ||
| if t1.Variation == t.Variation { | ||
| variation = es.targetMatchVariation(&t1) //nolint:gosec // see comments at top of file | ||
| variation = es.targetMatchVariation(&t1) | ||
| break | ||
| } | ||
| } | ||
| } else { | ||
| variation = es.targetMatchVariation(&t) //nolint:gosec // see comments at top of file | ||
| variation = es.targetMatchVariation(&t) | ||
| } | ||
| if variation.IsDefined() { | ||
| return variation | ||
|
|
@@ -316,7 +315,7 @@ func (es *evaluationScope) targetMatchVariation(t *ldmodel.Target) ldvalue.Optio | |
| func (es *evaluationScope) ruleMatchesContext(rule *ldmodel.FlagRule, stack evaluationStack) (bool, error) { | ||
| // Note that rule is passed by reference only for efficiency; we do not modify it | ||
| for _, clause := range rule.Clauses { | ||
| match, err := es.clauseMatchesContext(&clause, stack) //nolint:gosec // see comments at top of file | ||
| match, err := es.clauseMatchesContext(&clause, stack) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These gosec changes were made because the version of Go (in go.mod) was upgraded from 1.18 to 1.24. Sometime in that version gap, gosec no longer flags using the variable's address. |
||
| if !match || err != nil { | ||
| return match, err | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.