~samwhited/checkdoc

8aeb857799082cf52785ae094648b081ebabb6db — Sam Whited 1 year, 2 months ago 493919a
checkdoc: fix panic when file has no comments
1 files changed, 4 insertions(+), 1 deletions(-)

M header.go
M header.go => header.go +4 -1
@@ 62,7 62,10 @@ func fileHeader() *analysis.Analyzer {
					// TODO: is there a better way to detect this than checking for the
					// .go extension, or is this a bug that could be fixed upstream?
					continue
				case len(file.Comments) == 0 || pass.Fset.Position(file.Comments[0].List[0].Slash).Offset != 0:
				case len(file.Comments) == 0:
					pass.Reportf(file.Pos(), "no header comment found at start of file")
					continue
				case pass.Fset.Position(file.Comments[0].List[0].Slash).Offset != 0:
					pass.Reportf(file.Comments[0].List[0].Slash, "no header comment found at start of file")
					continue
				}