all: fix some staticcheck errors

Updates golang/go#35718

Change-Id: I10bfd5421cd44bb58b8bcaa6e9205040c25f51be
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208257
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
diff --git a/godoc/dirtrees.go b/godoc/dirtrees.go
index e9483a0..82c9a06 100644
--- a/godoc/dirtrees.go
+++ b/godoc/dirtrees.go
@@ -332,8 +332,8 @@
 // If filter is set, only the directory entries whose paths match the filter
 // are included.
 //
-func (root *Directory) listing(skipRoot bool, filter func(string) bool) *DirList {
-	if root == nil {
+func (dir *Directory) listing(skipRoot bool, filter func(string) bool) *DirList {
+	if dir == nil {
 		return nil
 	}
 
@@ -341,7 +341,7 @@
 	n := 0
 	minDepth := 1 << 30 // infinity
 	maxDepth := 0
-	for d := range root.iter(skipRoot) {
+	for d := range dir.iter(skipRoot) {
 		n++
 		if minDepth > d.Depth {
 			minDepth = d.Depth
@@ -358,7 +358,7 @@
 
 	// create list
 	list := make([]DirEntry, 0, n)
-	for d := range root.iter(skipRoot) {
+	for d := range dir.iter(skipRoot) {
 		if filter != nil && !filter(d.Path) {
 			continue
 		}
@@ -368,7 +368,7 @@
 		// the path is relative to root.Path - remove the root.Path
 		// prefix (the prefix should always be present but avoid
 		// crashes and check)
-		path := strings.TrimPrefix(d.Path, root.Path)
+		path := strings.TrimPrefix(d.Path, dir.Path)
 		// remove leading separator if any - path must be relative
 		path = strings.TrimPrefix(path, "/")
 		p.Path = path