Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mattJsonar committed Sep 6, 2024
1 parent 98ada49 commit 98dc8a1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions dsfhub/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dsfhub

import (
"errors"
"slices"
"strings"
)

Expand Down Expand Up @@ -36,8 +37,7 @@ func (c *Config) Client() (interface{}, error) {
return nil, errors.New(missingDSFHostMessage)
}
// Check sync_type param
syncType, exists := c.Params["syncType"]
if exists {
if syncType, exists := c.Params["syncType"]; exists {
if ! IsValidSyncType(syncType) {
return nil, errors.New(invalidSyncTypeMessage)
}
Expand All @@ -57,10 +57,5 @@ func (c *Config) Client() (interface{}, error) {
}

func IsValidSyncType (sync_type string) bool {
for _, valid_sync_type := range validSyncTypes {
if sync_type == valid_sync_type {
return true
}
}
return false
return slices.Contains(validSyncTypes, sync_type)
}

0 comments on commit 98dc8a1

Please sign in to comment.