Skip to content

Commit

Permalink
go add nolint:nilcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
albho committed Aug 15, 2024
1 parent a51f514 commit 2ea35a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions binding/go/porcupine.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ func (porcupine *Porcupine) Init() error {
Message: fmt.Sprintf("Specified model file could not be found at %s", porcupine.ModelPath)}
}

if len(porcupine.BuiltInKeywords) > 0 {
//nolint:nilcheck
if porcupine.BuiltInKeywords != nil && len(porcupine.BuiltInKeywords) > 0 {

Check failure on line 222 in binding/go/porcupine.go

View workflow job for this annotation

GitHub Actions / check-go-binding-codestyle

S1009: should omit nil check; len() for []github.com/Picovoice/porcupine/binding/go/v3.BuiltInKeyword is defined as zero (gosimple)
for _, keyword := range porcupine.BuiltInKeywords {
if !keyword.IsValid() {
return &PorcupineError{
Expand All @@ -230,7 +231,8 @@ func (porcupine *Porcupine) Init() error {
}
}

if len(porcupine.KeywordPaths) == 0 {
//nolint:nilcheck
if porcupine.KeywordPaths == nil || len(porcupine.KeywordPaths) == 0 {

Check failure on line 235 in binding/go/porcupine.go

View workflow job for this annotation

GitHub Actions / check-go-binding-codestyle

S1009: should omit nil check; len() for []string is defined as zero (gosimple)
return &PorcupineError{
StatusCode: INVALID_ARGUMENT,
Message: "No valid keywords were provided"}
Expand Down

0 comments on commit 2ea35a5

Please sign in to comment.