aboutsummaryrefslogtreecommitdiff
path: root/inspect.go
diff options
context:
space:
mode:
Diffstat (limited to 'inspect.go')
-rw-r--r--inspect.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/inspect.go b/inspect.go
index 0c05657..8452de5 100644
--- a/inspect.go
+++ b/inspect.go
@@ -45,7 +45,10 @@ func (f *Formatter) buildLineInfo(tokenFileSet *token.FileSet, parsedFile *ast.F
}
lineInformationMap[startLine] = &lineInformation{statementType: statementType, isTopLevel: true, isScoped: isScoped, isStartLine: true}
- lineInformationMap[endLine] = &lineInformation{statementType: statementType, isTopLevel: true, isScoped: isScoped, isStartLine: false}
+
+ if endLine != startLine {
+ lineInformationMap[endLine] = &lineInformation{statementType: statementType, isTopLevel: true, isScoped: isScoped, isStartLine: false}
+ }
}
ast.Inspect(parsedFile, func(astNode ast.Node) bool {