Skip to content

Add initializer for PartialResult#110

Merged
RincewindsHat merged 2 commits into
masterfrom
initalizers_for_results
Feb 13, 2024
Merged

Add initializer for PartialResult#110
RincewindsHat merged 2 commits into
masterfrom
initalizers_for_results

Conversation

@RincewindsHat
Copy link
Copy Markdown
Member

This commit adds a NewPartialResult function which returns a PartialResult struct with "sane" default, mainly setting the defaultState to "Unknown".

This should help developers implementing this library, since it avoids the following pattern:

sc := result.PartialResult{}
sc.setDefaultState(check.Unknown)

This pattern is quite common, but in a sense useless.

This commit adds a NewPartialResult function which returns a
PartialResult struct with "sane" default, mainly setting the
defaultState to "Unknown".

This should help developers implementing this library, since it
avoids the following pattern:

sc := result.PartialResult{}
sc.setDefaultState(check.Unknown)

This pattern is quite common, but in a sense useless.
Comment thread result/overall.go
defaultStateSet bool // nolint: unused
}

func NewPartialResult() PartialResult {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look alright. But could you add a doc string for the function, maybe describe why the defaults are what they are?

@RincewindsHat RincewindsHat merged commit fa1c479 into master Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants