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 Apr 21, 2024
1 parent e791aef commit f38f502
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions insert_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,7 @@ func (o *UniqueOpts) isEmpty() bool {
o.ByState == nil
}

var jobStateAll = []rivertype.JobState{ //nolint:gochecknoglobals
rivertype.JobStateAvailable,
rivertype.JobStateCancelled,
rivertype.JobStateCompleted,
rivertype.JobStateDiscarded,
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 f38f502

Please sign in to comment.