mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-12 22:38:46 -04:00
Fix: goheader linter can throw nil pointer exception in case of a source file has not issues (#1209)
* fix potential nil pointer exception Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com> * add test to cover Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com>
This commit is contained in:
parent
afa9be632b
commit
dfa0013583
4 changed files with 12 additions and 0 deletions
test
|
@ -193,6 +193,9 @@ func extractRunContextFromComments(t *testing.T, sourcePath string) *runContext
|
|||
skipMultilineComment(scanner)
|
||||
continue
|
||||
}
|
||||
if strings.TrimSpace(line) == "" {
|
||||
continue
|
||||
}
|
||||
if !strings.HasPrefix(line, "//") {
|
||||
return rc
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue