Skip to content

Commit

Permalink
Replace list of all job states with rivertype.JobStates()
Browse files Browse the repository at this point in the history
A small change that removes a list of all job states defined in
`insert_opts.go` that was used to validate states sent into `UniqueOpts`
with `rivertype.JobStates()` which was introduced recently n #297.
Removing one of the lists means we only need to maintain one of them.

I left the variable in place instead of invoking `rivertype.JobStates()`
so that we don't need to initialize a new slice every time we validate.
  • Loading branch information
brandur committed May 2, 2024
1 parent e59da8b commit 19c5da7
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions insert_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,7 @@ func (o *UniqueOpts) isEmpty() bool {
o.ByState == nil
}

var jobStateAll = []rivertype.JobState{ //nolint:gochecknoglobals
rivertype.JobStateAvailable,
rivertype.JobStateCancelled,
rivertype.JobStateCompleted,
rivertype.JobStateDiscarded,
rivertype.JobStatePending,
rivertype.JobStateRetryable,
rivertype.JobStateRunning,
rivertype.JobStateScheduled,
}
var jobStateAll = rivertype.JobStates() //nolint:gochecknoglobals

func (o *UniqueOpts) validate() error {
if o.isEmpty() {
Expand Down

0 comments on commit 19c5da7

Please sign in to comment.