Fix lint and govet errors.

Change-Id: I0efe2e5c2661304721f162c627cc8a7e58a72969
diff --git a/cache/cache.go b/cache/cache.go
index 3985bec..b76575f 100644
--- a/cache/cache.go
+++ b/cache/cache.go
@@ -36,6 +36,7 @@
 	FetchFrequency time.Duration
 }
 
+// NewCache sets up a Cache instance according to the given options.
 func NewCache(d string, opts Options) (*Cache, error) {
 	if opts.FetchFrequency == 0 {
 		opts.FetchFrequency = 12 * time.Hour
diff --git a/cmd/slothfs-expand-manifest/main.go b/cmd/slothfs-expand-manifest/main.go
index 642798d..48ac2e1 100644
--- a/cmd/slothfs-expand-manifest/main.go
+++ b/cmd/slothfs-expand-manifest/main.go
@@ -122,7 +122,7 @@
 		branch := mf.ProjectRevision(p)
 		commit, ok := proj.Branches[branch]
 		if !ok {
-			return fmt.Errorf("branch %q for repo %s not returned.", branch, p.Name)
+			return fmt.Errorf("branch %q for repo %s not returned", branch, p.Name)
 		}
 
 		p.Revision = commit
diff --git a/cookie/cookie.go b/cookie/cookie.go
index f25e884..cdb6282 100644
--- a/cookie/cookie.go
+++ b/cookie/cookie.go
@@ -110,7 +110,7 @@
 				}
 
 			case <-w.Errors:
-				log.Printf("notify: %v", path, err)
+				log.Printf("notify (%s):  %v", path, err)
 			}
 		}
 	}()
diff --git a/fs/config.go b/fs/config.go
index ab49e66..2faaf3d 100644
--- a/fs/config.go
+++ b/fs/config.go
@@ -26,7 +26,7 @@
 	Clone bool
 }
 
-// Reads a JSON file containing clone options
+// ReadConfig reads a JSON file containing clone options
 func ReadConfig(contents []byte) (repo []CloneOption, file []CloneOption, err error) {
 	var cfg []configEntry
 	if err := json.Unmarshal(contents, &cfg); err != nil {
diff --git a/fs/gitilesfs.go b/fs/gitilesfs.go
index 77562eb..6131d9b 100644
--- a/fs/gitilesfs.go
+++ b/fs/gitilesfs.go
@@ -278,11 +278,11 @@
 	return fuse.OK
 }
 
-func (d *dataNode) Open(flags uint32, content *fuse.Context) (nodefs.File, fuse.Status) {
-	return nodefs.NewDataFile(d.data), fuse.OK
+func (n *dataNode) Open(flags uint32, content *fuse.Context) (nodefs.File, fuse.Status) {
+	return nodefs.NewDataFile(n.data), fuse.OK
 }
 
-func (d *dataNode) GetXAttr(attribute string, context *fuse.Context) (data []byte, code fuse.Status) {
+func (n *dataNode) GetXAttr(attribute string, context *fuse.Context) (data []byte, code fuse.Status) {
 	return nil, fuse.ENODATA
 }
 
@@ -312,7 +312,7 @@
 
 func (r *gitilesRoot) Deletable() bool { return false }
 
-func (n *gitilesRoot) GetXAttr(attribute string, context *fuse.Context) (data []byte, code fuse.Status) {
+func (r *gitilesRoot) GetXAttr(attribute string, context *fuse.Context) (data []byte, code fuse.Status) {
 	return nil, fuse.ENODATA
 }
 
diff --git a/fs/gitilesfs_test.go b/fs/gitilesfs_test.go
index a749287..b39ea25 100644
--- a/fs/gitilesfs_test.go
+++ b/fs/gitilesfs_test.go
@@ -734,7 +734,7 @@
 	}
 
 	if got, err := os.Readlink(configName); err != nil {
-		t.Fatalf("Readlink(%s): %", configName, err)
+		t.Fatalf("Readlink(%s): %v", configName, err)
 	} else if want := "../ws/.slothfs/manifest.xml"; got != want {
 		t.Errorf("got link %s, want %s", got, want)
 	}
@@ -787,7 +787,7 @@
 
 	wsDir := filepath.Join(fix.mntDir, "ws")
 	if _, err := os.Lstat(wsDir); err != nil {
-		t.Fatalf("Lstat(%s): %v", wsDir)
+		t.Fatalf("Lstat(%s): %v", wsDir, err)
 	}
 
 	if err := os.Remove(filepath.Join(fix.mntDir, "config", "ws")); err != nil {
diff --git a/fs/manifestfs.go b/fs/manifestfs.go
index 888eda7..2450c02 100644
--- a/fs/manifestfs.go
+++ b/fs/manifestfs.go
@@ -80,23 +80,23 @@
 	return root, nil
 }
 
-func (fs *manifestFSRoot) OnMount(fsConn *nodefs.FileSystemConnector) {
-	if err := fs.onMount(fsConn); err != nil {
+func (r *manifestFSRoot) OnMount(fsConn *nodefs.FileSystemConnector) {
+	if err := r.onMount(fsConn); err != nil {
 		log.Printf("onMount: %v", err)
-		for k := range fs.Inode().Children() {
-			fs.Inode().RmChild(k)
+		for k := range r.Inode().Children() {
+			r.Inode().RmChild(k)
 		}
 
-		fs.Inode().NewChild("ERROR", false, newDataNode([]byte(err.Error())))
+		r.Inode().NewChild("ERROR", false, newDataNode([]byte(err.Error())))
 	}
 
 	// Don't need the trees anymore.
-	fs.trees = nil
+	r.trees = nil
 }
 
-func (fs *manifestFSRoot) onMount(fsConn *nodefs.FileSystemConnector) error {
+func (r *manifestFSRoot) onMount(fsConn *nodefs.FileSystemConnector) error {
 	var byDepth [][]string
-	for p := range fs.trees {
+	for p := range r.trees {
 		d := len(strings.Split(p, "/"))
 		for len(byDepth) <= d {
 			byDepth = append(byDepth, nil)
@@ -107,8 +107,8 @@
 
 	clonablePaths := map[string]bool{}
 	revmap := map[string]*manifest.Project{}
-	for i, p := range fs.options.Manifest.Project {
-		revmap[p.Path] = &fs.options.Manifest.Project[i]
+	for i, p := range r.options.Manifest.Project {
+		revmap[p.Path] = &r.options.Manifest.Project[i]
 
 		if p.CloneDepth == "" {
 			clonablePaths[p.Path] = true
@@ -120,7 +120,7 @@
 	for _, ps := range byDepth {
 		for _, p := range ps {
 			dir, base := filepath.Split(p)
-			parent, left := fsConn.Node(fs.Inode(), dir)
+			parent, left := fsConn.Node(r.Inode(), dir)
 			for _, c := range left {
 				ch := parent.NewChild(c, true, newDirNode())
 				parent = ch
@@ -128,7 +128,7 @@
 
 			clone, ok := clonablePaths[p]
 			if !ok {
-				for _, e := range fs.options.RepoCloneOption {
+				for _, e := range r.options.RepoCloneOption {
 					if e.RE.FindString(p) != "" {
 						clone = e.Clone
 						break
@@ -141,16 +141,16 @@
 				cloneURL = ""
 			}
 
-			repoService := fs.service.NewRepoService(revmap[p].Name)
+			repoService := r.service.NewRepoService(revmap[p].Name)
 
 			opts := GitilesOptions{
 				Revision:    revmap[p].Revision,
 				CloneURL:    cloneURL,
-				CloneOption: fs.options.FileCloneOption,
+				CloneOption: r.options.FileCloneOption,
 			}
 
-			subRoot := NewGitilesRoot(fs.cache, fs.trees[p], repoService, opts)
-			subRoot.(*gitilesRoot).nodeCache = fs.nodeCache
+			subRoot := NewGitilesRoot(r.cache, r.trees[p], repoService, opts)
+			subRoot.(*gitilesRoot).nodeCache = r.nodeCache
 			parent.NewChild(base, true, subRoot)
 			if err := subRoot.(*gitilesRoot).onMount(fsConn); err != nil {
 				return fmt.Errorf("onMount(%s): %v", p, err)
@@ -160,14 +160,14 @@
 
 	// Do Linkfile, Copyfile after setting up the repos, so we
 	// have directories to attach the copy/link nodes to.
-	for _, p := range fs.options.Manifest.Project {
+	for _, p := range r.options.Manifest.Project {
 		for _, cp := range p.Copyfile {
-			srcNode, left := fsConn.Node(fs.Inode(), filepath.Join(p.Path, cp.Src))
+			srcNode, left := fsConn.Node(r.Inode(), filepath.Join(p.Path, cp.Src))
 			if len(left) > 0 {
 				return fmt.Errorf("Copyfile(%s): source %s does not exist", p.Name, cp.Src)
 			}
 
-			dir, left := fsConn.Node(fs.Inode(), cp.Dest)
+			dir, left := fsConn.Node(r.Inode(), cp.Dest)
 			switch len(left) {
 			case 0:
 				return fmt.Errorf("Copyfile(%s): dest %s already exists.", p.Name, cp.Dest)
@@ -180,7 +180,7 @@
 		}
 
 		for _, lf := range p.Linkfile {
-			dir, left := fsConn.Node(fs.Inode(), lf.Dest)
+			dir, left := fsConn.Node(r.Inode(), lf.Dest)
 			switch len(left) {
 			case 0:
 				return fmt.Errorf("Linkfile(%s): dest %s already exists.", p.Name, lf.Dest)
@@ -200,8 +200,8 @@
 		}
 	}
 
-	metaNode := fs.Inode().NewChild(".slothfs", true, newDirNode())
-	metaNode.NewChild("manifest.xml", false, newDataNode(fs.manifestXML))
+	metaNode := r.Inode().NewChild(".slothfs", true, newDirNode())
+	metaNode.NewChild("manifest.xml", false, newDataNode(r.manifestXML))
 
 	var tree gitiles.Tree
 	treeContent, err := json.Marshal(tree)
diff --git a/fs/multifs.go b/fs/multifs.go
index 3c72c05..b039f19 100644
--- a/fs/multifs.go
+++ b/fs/multifs.go
@@ -63,11 +63,11 @@
 	r.Inode().NewChild("config", true, cfg)
 
 	if err := cfg.configureWorkspaces(); err != nil {
-		log.Println("configureWorkspaces: %v", err)
+		log.Printf("configureWorkspaces: %v", err)
 	}
 }
 
-func (r *configNode) Deletable() bool { return false }
+func (c *configNode) Deletable() bool { return false }
 
 func NewMultiFS(service *gitiles.Service, c *cache.Cache, options MultiFSOptions) *multiManifestFSRoot {
 	r := &multiManifestFSRoot{
@@ -105,7 +105,7 @@
 	return c.link, fuse.OK
 }
 
-func (r *configEntryNode) Deletable() bool { return false }
+func (c *configEntryNode) Deletable() bool { return false }
 
 func (c *configNode) Unlink(name string, ctx *fuse.Context) fuse.Status {
 	child := c.root.Inode().RmChild(name)
@@ -167,7 +167,7 @@
 	})
 
 	if err := fs.(*manifestFSRoot).onMount(c.root.fsConn); err != nil {
-		log.Println("onMount(%s): %v", name, err)
+		log.Printf("onMount(%s): %v", name, err)
 		for k := range child.Children() {
 			child.RmChild(k)
 		}
diff --git a/gitiles/client.go b/gitiles/client.go
index 5da2ea4..9422540 100644
--- a/gitiles/client.go
+++ b/gitiles/client.go
@@ -56,6 +56,8 @@
 	UserAgent string
 }
 
+// LoadCookieJar sets up a cookiejar file to load and watch for
+// changes.
 func (o *Options) LoadCookieJar(nm string) error {
 	if nm == "" {
 		return nil
@@ -173,6 +175,7 @@
 	return projects, err
 }
 
+// NewRepoService creates a service for a specific repository on a Gitiles server.
 func (s *Service) NewRepoService(name string) *RepoService {
 	return &RepoService{
 		Name:    name,
diff --git a/gitiles/types.go b/gitiles/types.go
index b10ecbc..0b9a593 100644
--- a/gitiles/types.go
+++ b/gitiles/types.go
@@ -16,6 +16,7 @@
 
 import "fmt"
 
+// Project describes a repository
 type Project struct {
 	Name        string
 	CloneURL    string            `json:"clone_url"`
@@ -23,6 +24,7 @@
 	Branches    map[string]string `json:"branches"`
 }
 
+// Person describes a committer or author.
 type Person struct {
 	Name  string
 	Email string
@@ -31,6 +33,7 @@
 	Time string
 }
 
+// DiffEntry describes a file difference.
 type DiffEntry struct {
 	Type    string
 	OldID   string `json:"old_id"`
@@ -41,6 +44,7 @@
 	NewPath string `json:"new_path"`
 }
 
+// Commit describes a git commit.
 type Commit struct {
 	Commit    string
 	Tree      string
@@ -51,11 +55,13 @@
 	TreeDiff  []DiffEntry `json:"tree_diff"`
 }
 
+// Log holds the output of a revwalk.
 type Log struct {
 	Log  []Commit
 	Next string
 }
 
+// BlameRegion represents a attribution of a file range.
 type BlameRegion struct {
 	Start  int
 	Count  int
@@ -64,10 +70,12 @@
 	Author Person
 }
 
+// Blame represents all of the BlameRegions in a file.
 type Blame struct {
 	Regions []BlameRegion
 }
 
+// TreeEntry holds a single entry in a tree.
 type TreeEntry struct {
 	Mode int
 	Type string
@@ -90,6 +98,7 @@
 	return s
 }
 
+// Tree holds a (possibly recursively expanded) tree.
 type Tree struct {
 	ID      string
 	Entries []TreeEntry
diff --git a/manifest/types.go b/manifest/types.go
index 343b42c..ea11d5e 100644
--- a/manifest/types.go
+++ b/manifest/types.go
@@ -72,10 +72,6 @@
 	SyncS      string `xml:"sync-s,attr"`
 }
 
-type ManifestServer struct {
-	URL string `xml:"url,attr"`
-}
-
 // Manifest holds the entire manifest, describing a set of git
 // projects to be stitched together
 type Manifest struct {
diff --git a/populate/populate.go b/populate/populate.go
index 1654efd..a8fd03b 100644
--- a/populate/populate.go
+++ b/populate/populate.go
@@ -12,8 +12,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// populate holds the code to augment a partial R/W checkout with a
-// symlink forest into a SlothFS workspace.
+// Package populate holds the code to augment a partial R/W checkout
+// with a symlink forest into a SlothFS workspace.
 package populate
 
 import (
diff --git a/populate/repotree.go b/populate/repotree.go
index 7be46eb..6ebce37 100644
--- a/populate/repotree.go
+++ b/populate/repotree.go
@@ -220,7 +220,7 @@
 }
 
 // construct fills `parent` looking through `dir` subdir of `repoRoot`.
-func (parent *repoTree) fill(repoRoot, dir string) error {
+func (t *repoTree) fill(repoRoot, dir string) error {
 	entries, err := ioutil.ReadDir(filepath.Join(repoRoot, dir))
 	if err != nil {
 		log.Println(repoRoot, err)
@@ -241,13 +241,13 @@
 		if e.IsDir() {
 			if newRoot := filepath.Join(repoRoot, subName); isRepoDir(newRoot) {
 				ch := makeRepoTree()
-				parent.children[subName] = ch
+				t.children[subName] = ch
 				todo[newRoot] = ch
 			} else {
-				parent.fill(repoRoot, subName)
+				t.fill(repoRoot, subName)
 			}
 		} else {
-			parent.entries[subName] = &fileInfo{}
+			t.entries[subName] = &fileInfo{}
 		}
 	}