diff --git a/binding/go/porcupine.go b/binding/go/porcupine.go index 9bb85c0d9..f7fd29f22 100644 --- a/binding/go/porcupine.go +++ b/binding/go/porcupine.go @@ -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 { for _, keyword := range porcupine.BuiltInKeywords { if !keyword.IsValid() { return &PorcupineError{ @@ -230,7 +231,8 @@ func (porcupine *Porcupine) Init() error { } } - if len(porcupine.KeywordPaths) == 0 { + //nolint:nilcheck + if porcupine.KeywordPaths == nil || len(porcupine.KeywordPaths) == 0 { return &PorcupineError{ StatusCode: INVALID_ARGUMENT, Message: "No valid keywords were provided"}