Commits

Paul Ruane committed 74d8ff2

Renamed 'error' variables to 'err' to avoid confusion with 'error' type.

  • Participants
  • Parent commits daae0d5

Comments (0)

Files changed (20)

File src/main/commands/delete.go

 		return errors.New("No tags to delete specified.")
 	}
 
-	db, error := OpenDatabase(databasePath())
-	if error != nil { return error }
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	defer db.Close()
 
 	for _, tagName := range args {
-		error = command.deleteTag(db, tagName)
-		if error != nil { return error }
+		err = command.deleteTag(db, tagName)
+		if err != nil { return err }
 	}
 
 	return nil
 }
 
 func (DeleteCommand) deleteTag(db *Database, tagName string) error {
-	tag, error := db.TagByName(tagName)
-	if error != nil { return error }
+	tag, err := db.TagByName(tagName)
+	if err != nil { return err }
 
 	if tag == nil {
 		return errors.New("No such tag '" + tagName + "'.")
 	}
 
-	fileTags, error := db.FileTagsByTagId(tag.Id)
-	if error != nil { return error }
+	fileTags, err := db.FileTagsByTagId(tag.Id)
+	if err != nil { return err }
 
-	error = db.RemoveFileTagsByTagId(tag.Id)
-	if error != nil { return error }
+	err = db.RemoveFileTagsByTagId(tag.Id)
+	if err != nil { return err }
 
-	error = db.DeleteTag(tag.Id)
-	if error != nil { return error }
+	err = db.DeleteTag(tag.Id)
+	if err != nil { return err }
 
 	for _, fileTag := range fileTags {
-		hasTags, error := db.AnyFileTagsForFile(fileTag.FileId)
-		if error != nil { return error }
+		hasTags, err := db.AnyFileTagsForFile(fileTag.FileId)
+		if err != nil { return err }
 
 		if !hasTags {
 			db.RemoveFile(fileTag.FileId)

File src/main/commands/dupes.go

 }
 
 func (DupesCommand) findDuplicates() error {
-    db, error := OpenDatabase(databasePath())
-    if error != nil { return error }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { return err }
     defer db.Close()
 
-    fileSets, error := db.DuplicateFiles()
-    if error != nil { return error }
+    fileSets, err := db.DuplicateFiles()
+    if err != nil { return err }
 
     for index, fileSet := range fileSets {
         if index > 0 { fmt.Println() }
 }
 
 func (DupesCommand) findDuplicatesOf(path string) error {
-    db, error := OpenDatabase(databasePath())
-    if error != nil { return error }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { return err }
     defer db.Close()
 
-    fingerprint, error := Fingerprint(path)
-    if error != nil { return error }
+    fingerprint, err := Fingerprint(path)
+    if err != nil { return err }
 
-    files, error := db.FilesByFingerprint(fingerprint)
-    if error != nil { return error }
+    files, err := db.FilesByFingerprint(fingerprint)
+    if err != nil { return err }
 
-    absPath, error := filepath.Abs(path)
-    if error != nil { return error }
+    absPath, err := filepath.Abs(path)
+    if err != nil { return err }
 
     for _, file := range files {
         if file.Path() == absPath { continue }

File src/main/commands/export.go

 		return errors.New("Unpected argument to command '" + command.Name() + "'.")
 	}
 
-	db, error := OpenDatabase(databasePath())
-	if error != nil {
-		return error
-	}
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	defer db.Close()
 
-	files, error := db.Files()
-	if error != nil {
-		return error
-	}
+	files, err := db.Files()
+	if err != nil { return err }
 
 	for _, file := range files {
 		fmt.Printf("%v,%v,", file.Path(), file.Fingerprint)
 
-		tags, error := db.TagsByFileId(file.Id)
-		if error != nil {
-			return error
-		}
+		tags, err := db.TagsByFileId(file.Id)
+		if err != nil { return err }
 
 		tagNames := make([]string, 0, len(tags))
 
 
 	return nil
 }
+

File src/main/commands/files.go

 }
 
 func (FilesCommand) listAllFiles() error {
-    db, error := OpenDatabase(databasePath())
-    if error != nil { return error }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { return err }
     defer db.Close()
 
-    files, error := db.Files()
-    if error != nil { return error }
+    files, err := db.Files()
+    if err != nil { return err }
 
     for _, file := range files {
         fmt.Println(file.Path())
 func (FilesCommand) listFiles(tagNames []string) error {
     if len(tagNames) == 0 { return errors.New("At least one tag must be specified.") }
 
-    db, error := OpenDatabase(databasePath())
-    if error != nil { return error }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { return err }
     defer db.Close()
 
     for _, tagName := range tagNames {
-        tag, error := db.TagByName(tagName)
-        if error != nil { return error }
+        tag, err := db.TagByName(tagName)
+        if err != nil { return err }
         if tag == nil { return errors.New("No such tag '" + tagName + "'.") }
     }
 
-    files, error := db.FilesWithTags(tagNames)
-    if error != nil { return error }
+    files, err := db.FilesWithTags(tagNames)
+    if err != nil { return err }
 
     for _, file := range files {
         fmt.Println(file.Path())

File src/main/commands/merge.go

 }
 
 func (MergeCommand) Exec(args []string) error {
-	db, error := OpenDatabase(databasePath())
-	if error != nil { return error }
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	//defer db.Close()
 
 	sourceTagName := args[0]
 	destTagName := args[1]
 
-	sourceTag, error := db.TagByName(sourceTagName)
-	if error != nil { return error }
+	sourceTag, err := db.TagByName(sourceTagName)
+	if err != nil { return err }
 	if sourceTag == nil { return errors.New("No such tag '" + sourceTagName + "'.") }
 
-	destTag, error := db.TagByName(destTagName)
-	if error != nil { return error }
+	destTag, err := db.TagByName(destTagName)
+	if err != nil { return err }
 	if destTag == nil { return errors.New("No such tag '" + destTagName + "'.") }
 
-    fileTags, error := db.FileTagsByTagId(sourceTag.Id)
-    if error != nil { return error }
+    fileTags, err := db.FileTagsByTagId(sourceTag.Id)
+    if err != nil { return err }
 
     for _, fileTag := range fileTags {
-        destFileTag, error := db.FileTagByFileIdAndTagId(fileTag.FileId, destTag.Id)
-        if error != nil { return error }
+        destFileTag, err := db.FileTagByFileIdAndTagId(fileTag.FileId, destTag.Id)
+        if err != nil { return err }
         if destFileTag != nil { continue }
 
-        _, error = db.AddFileTag(fileTag.FileId, destTag.Id)
-        if error != nil { return error }
+        _, err = db.AddFileTag(fileTag.FileId, destTag.Id)
+        if err != nil { return err }
     }
 
-    error = db.RemoveFileTagsByTagId(sourceTag.Id)
-    if error != nil { return error }
+    err = db.RemoveFileTagsByTagId(sourceTag.Id)
+    if err != nil { return err }
 
-	error = db.DeleteTag(sourceTag.Id)
-	if error != nil { return error }
+	err = db.DeleteTag(sourceTag.Id)
+	if err != nil { return err }
 
-	error = db.Close()
-	if error != nil { return error }
+	err = db.Close()
+	if err != nil { return err }
 
 	return nil
 }

File src/main/commands/mount.go

 }
 
 func (MountCommand) Exec(args []string) error {
-	if len(args) < 1 { errors.New("No mountpoint specified.") }
-	if len(args) > 1 { errors.New("Extraneous arguments.") }
+	if len(args) < 1 { return errors.New("No mountpoint specified.") }
+	if len(args) > 1 { return errors.New("Extraneous arguments.") }
 
     path := args[0]
 
-    fileInfo, error := os.Stat(path)
-    if error != nil { return error }
+    fileInfo, err := os.Stat(path)
+    if err != nil { return err }
     if fileInfo == nil { return errors.New("Mount point '" + path + "' does not exist.") }
     if !fileInfo.IsDir() { return errors.New("Mount point '" + path + "' is not a directory.") }
 
 	mountPath := args[0]
 	command := exec.Command(os.Args[0], "vfs", databasePath(), mountPath)
 
-	errorPipe, error := command.StderrPipe()
-	if error != nil { return error }
+	errorPipe, err := command.StderrPipe()
+	if err != nil { return err }
 
-	error = command.Start()
-	if error != nil { return error }
+	err = command.Start()
+	if err != nil { return err }
 
     const HALF_SECOND = 500000000
     time.Sleep(HALF_SECOND)
 
-    waitMessage, error := command.Process.Wait(os.WNOHANG)
-    if error != nil { return error }
+    waitMessage, err := command.Process.Wait(os.WNOHANG)
+    if err != nil { return err }
 
     if waitMessage.WaitStatus.Exited() {
         if waitMessage.WaitStatus.ExitStatus() != 0 {
             buffer := make([]byte, 1024)
-            count, error := errorPipe.Read(buffer)
-            if error != nil { return error }
+            count, err := errorPipe.Read(buffer)
+            if err != nil { return err }
 
             return errors.New("Could not mount VFS: " + string(buffer[0:count]))
         }

File src/main/commands/rename.go

 }
 
 func (RenameCommand) Exec(args []string) error {
-	db, error := OpenDatabase(databasePath())
-	if error != nil { return error }
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	defer db.Close()
 
 	sourceTagName := args[0]
 	destTagName := args[1]
 
-	sourceTag, error := db.TagByName(sourceTagName)
-	if error != nil { return error }
-	if sourceTag == nil {
-		return errors.New("No such tag '" + sourceTagName + "'.")
-	}
+	sourceTag, err := db.TagByName(sourceTagName)
+	if err != nil { return err }
+	if sourceTag == nil { return errors.New("No such tag '" + sourceTagName + "'.") }
 
-	destTag, error := db.TagByName(destTagName)
-	if error != nil { return error }
-	if destTag != nil {
-		return errors.New("A tag with name '" + destTagName + "' already exists.")
-	}
+	destTag, err := db.TagByName(destTagName)
+	if err != nil { return err }
+	if destTag != nil { return errors.New("A tag with name '" + destTagName + "' already exists.") }
 
-	_, error = db.RenameTag(sourceTag.Id, destTagName)
-	if error != nil { return error }
+	_, err = db.RenameTag(sourceTag.Id, destTagName)
+	if err != nil { return err }
 
 	return nil
 }

File src/main/commands/stats.go

 }
 
 func (StatsCommand) Exec(args []string) error {
-    db, error := OpenDatabase(databasePath())
-    if error != nil { return error }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { return err }
     defer db.Close()
 
-    tagCount, error := db.TagCount()
-    if error != nil { return error }
+    tagCount, err := db.TagCount()
+    if err != nil { return err }
 
-    fileCount, error := db.FileCount()
-    if error != nil { return error }
+    fileCount, err := db.FileCount()
+    if err != nil { return err }
 
-    fileTagCount, error := db.FileTagCount()
-    if error != nil { return error }
+    fileTagCount, err := db.FileTagCount()
+    if err != nil { return err }
 
     fmt.Printf("Database Contents\n")
 

File src/main/commands/status.go

     untagged := make([]string, 0, 10)
     missing := make([]string, 0, 10)
     allFiles := false
-    var error error
+    var err error
 
     if len(args) > 0 && args[0] == "--all" {
         allFiles = true
     }
 
     if len(args) == 0 {
-        tagged, untagged, missing, error = command.status([]string { "." }, tagged, untagged, missing, allFiles)
+        tagged, untagged, missing, err = command.status([]string { "." }, tagged, untagged, missing, allFiles)
     } else {
-        tagged, untagged, missing, error = command.status(args, tagged, untagged, missing, allFiles)
+        tagged, untagged, missing, err = command.status(args, tagged, untagged, missing, allFiles)
     }
 
-    if error != nil { return error }
+    if err != nil { return err }
 
     for _, absPath := range tagged {
-        path, error := makeRelative(absPath)
-        if error != nil { return error }
+        path, err := makeRelative(absPath)
+        if err != nil { return err }
 
         fmt.Printf("T %v\n", path)
     }
 
     for _, absPath := range missing {
-        path, error := makeRelative(absPath)
-        if error != nil { return error }
+        path, err := makeRelative(absPath)
+        if err != nil { return err }
 
         fmt.Printf("! %v\n", path)
     }
 
     for _, absPath := range untagged {
-        path, error := makeRelative(absPath)
-        if error != nil { return error }
+        path, err := makeRelative(absPath)
+        if err != nil { return err }
 
         fmt.Printf("? %v\n", path)
     }
 
 func (command StatusCommand) status(paths []string, tagged []string, untagged []string, missing []string, allFiles bool) ([]string, []string, []string, error) {
     for _, path := range paths {
-        databaseEntries, error := command.getDatabaseEntries(path)
-        if error != nil { return nil, nil, nil, error }
+        databaseEntries, err := command.getDatabaseEntries(path)
+        if err != nil { return nil, nil, nil, err }
 
-        fileSystemEntries, error := command.getFileSystemEntries(path, allFiles)
-        if error != nil { return nil, nil, nil, error }
+        fileSystemEntries, err := command.getFileSystemEntries(path, allFiles)
+        if err != nil { return nil, nil, nil, err }
 
         for _, entry := range databaseEntries {
             if contains(fileSystemEntries, entry) {
 }
 
 func (command StatusCommand) getFileSystemEntriesRecursive(path string, entries []string, allFiles bool) ([]string, error) {
-    fileInfo, error := os.Lstat(path)
-    if error != nil { return nil, error }
+    fileInfo, err := os.Lstat(path)
+    if err != nil { return nil, err }
 
-    absPath, error := filepath.Abs(path)
-    if error != nil { return nil, error }
+    absPath, err := filepath.Abs(path)
+    if err != nil { return nil, err }
 
     basename := filepath.Base(absPath)
 
         if isRegular(fileInfo)  {
             entries = append(entries, absPath)
         } else if fileInfo.IsDir() {
-            childEntries, error := directoryEntries(absPath)
-            if error != nil { return nil, error }
+            childEntries, err := directoryEntries(absPath)
+            if err != nil { return nil, err }
 
             for _, entry := range childEntries {
-                entries, error = command.getFileSystemEntriesRecursive(entry, entries, allFiles)
-                if error != nil { return nil, error }
+                entries, err = command.getFileSystemEntriesRecursive(entry, entries, allFiles)
+                if err != nil { return nil, err }
             }
         }
     }
 }
 
 func (StatusCommand) getDatabaseEntries(path string) ([]string, error) {
-    db, error := OpenDatabase(databasePath())
-    if error != nil { return nil, error }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { return nil, err }
     defer db.Close()
 
-    absPath, error := filepath.Abs(path)
-    if error != nil { return nil, error }
+    absPath, err := filepath.Abs(path)
+    if err != nil { return nil, err }
 
-    files, error := db.FilesByDirectory(absPath)
-    if error != nil { return nil, error }
+    files, err := db.FilesByDirectory(absPath)
+    if err != nil { return nil, err }
 
     entries := make([]string, 0, len(files))
     for _, file := range files {
 }
 
 func makeRelative(path string) (string, error) {
-    workingDirectory, error := os.Getwd()
-    if error != nil { return "", error }
+    workingDirectory, err := os.Getwd()
+    if err != nil { return "", err }
 
     workingDirectory += string(filepath.Separator)
 

File src/main/commands/tag.go

 		return errors.New("File to tag and tags to apply must be specified.")
 	}
 
-	error := command.tagPath(args[0], args[1:])
-	if error != nil { return error }
+	err := command.tagPath(args[0], args[1:])
+	if err != nil { return err }
 
 	return nil
 }
 
 func (command TagCommand) tagPath(path string, tagNames []string) error {
-	db, error := OpenDatabase(databasePath())
-	if error != nil { return error }
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	defer db.Close()
 
-	absPath, error := filepath.Abs(path)
-	if error != nil { return error }
+	absPath, err := filepath.Abs(path)
+	if err != nil { return err }
 
-	file, error := command.addFile(db, absPath)
-	if error != nil { return error }
+	file, err := command.addFile(db, absPath)
+	if err != nil { return err }
 
 	for _, tagName := range tagNames {
-		_, _, error = command.applyTag(db, path, file.Id, tagName)
-		if error != nil { return error }
+		_, _, err = command.applyTag(db, path, file.Id, tagName)
+		if err != nil { return err }
 	}
 
 	return nil
         return nil, nil, errors.New("Tag names cannot contain spaces.")
     }
 
-	tag, error := db.TagByName(tagName)
-	if error != nil { return nil, nil, error }
+	tag, err := db.TagByName(tagName)
+	if err != nil { return nil, nil, err }
 
 	if tag == nil {
 		fmt.Printf("New tag '%v'\n", tagName)
-		tag, error = db.AddTag(tagName)
-		if error != nil { return nil, nil, error }
+		tag, err = db.AddTag(tagName)
+		if err != nil { return nil, nil, err }
 	}
 
-	fileTag, error := db.FileTagByFileIdAndTagId(fileId, tag.Id)
-	if error != nil { return nil, nil, error }
+	fileTag, err := db.FileTagByFileIdAndTagId(fileId, tag.Id)
+	if err != nil { return nil, nil, err }
 
 	if fileTag == nil {
-		_, error := db.AddFileTag(fileId, tag.Id)
-		if error != nil { return nil, nil, error }
+		_, err := db.AddFileTag(fileId, tag.Id)
+		if err != nil { return nil, nil, err }
 	}
 
 	return tag, fileTag, nil
 }
 
 func (TagCommand) addFile(db *Database, path string) (*File, error) {
-	fingerprint, error := Fingerprint(path)
-	if error != nil { return nil, error }
+	fingerprint, err := Fingerprint(path)
+	if err != nil { return nil, err }
 
-	file, error := db.FileByPath(path)
-	if error != nil { return nil, error }
+	file, err := db.FileByPath(path)
+	if err != nil { return nil, err }
 
 	if file == nil {
-		files, error := db.FilesByFingerprint(fingerprint)
-		if error != nil { return nil, error }
+		files, err := db.FilesByFingerprint(fingerprint)
+		if err != nil { return nil, err }
 
 		if len(files) > 0 {
 			fmt.Printf("Warning: file is a duplicate of previously tagged files.\n")
             }
 		}
 
-		file, error = db.AddFile(path, fingerprint)
-		if error != nil { return nil, error }
+		file, err = db.AddFile(path, fingerprint)
+		if err != nil { return nil, err }
 	} else {
 		if file.Fingerprint != fingerprint {
 			db.UpdateFileFingerprint(file.Id, fingerprint)

File src/main/commands/tags.go

 }
 
 func (TagsCommand) listAllTags() error {
-	db, error := OpenDatabase(databasePath())
-	if error != nil { return error }
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	defer db.Close()
 
-	tags, error := db.Tags()
-	if error != nil { return error }
+	tags, err := db.Tags()
+	if err != nil { return err }
 
 	for _, tag := range tags {
 		fmt.Println(tag.Name)
 }
 
 func (command TagsCommand) listTags(paths []string) error {
-	db, error := OpenDatabase(databasePath())
-	if error != nil { return error }
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	defer db.Close()
 
     switch len(paths) {
 }
 
 func (command TagsCommand) listTagsForPath(db *Database, path string) error {
-    tags, error := command.tagsForPath(db, path)
-    if error != nil { return error }
+    tags, err := command.tagsForPath(db, path)
+    if err != nil { return err }
 
     for _, tag := range tags {
         fmt.Println(tag.Name)
 
 func (command TagsCommand) listTagsRecursive(db *Database, paths []string) error {
     for _, path := range paths {
-        fileInfo, error := os.Lstat(path)
-        if error != nil { return error }
+        fileInfo, err := os.Lstat(path)
+        if err != nil { return err }
 
         if fileInfo.Mode() & os.ModeType == 0 {
-            tags, error := command.tagsForPath(db, path)
-            if error != nil { return error }
+            tags, err := command.tagsForPath(db, path)
+            if err != nil { return err }
             if tags == nil { continue }
 
             if len(tags) > 0 {
                 fmt.Println()
             }
         } else if fileInfo.IsDir() {
-            file, error := os.Open(path)
-            if error != nil { return error }
+            file, err := os.Open(path)
+            if err != nil { return err }
             defer file.Close()
 
-            dirNames, error := file.Readdirnames(0)
-            if error != nil { return error }
+            dirNames, err := file.Readdirnames(0)
+            if err != nil { return err }
 
             childPaths := make([]string, len(dirNames))
             for index, dirName := range dirNames {
                 childPaths[index] = filepath.Join(path, dirName)
             }
 
-            error = command.listTagsRecursive(db, childPaths)
-            if error != nil { return error }
+            err = command.listTagsRecursive(db, childPaths)
+            if err != nil { return err }
         }
     }
 
 }
 
 func (TagsCommand) tagsForPath(db *Database, path string) ([]Tag, error) {
-	absPath, error := filepath.Abs(path)
-	if error != nil { return nil, error }
+	absPath, err := filepath.Abs(path)
+	if err != nil { return nil, err }
 
-	file, error := db.FileByPath(absPath)
-	if error != nil { return nil, error }
+	file, err := db.FileByPath(absPath)
+	if err != nil { return nil, err }
 	if file == nil { return nil, nil }
 
-	tags, error := db.TagsByFileId(file.Id)
-	if error != nil { return nil, error }
+	tags, err := db.TagsByFileId(file.Id)
+	if err != nil { return nil, err }
 
-	return tags, error
+	return tags, err
 }

File src/main/commands/unmount.go

 
 	path := args[0]
 
-	fusermountPath, error := exec.LookPath("fusermount")
-	if error != nil { return error }
+	fusermountPath, err := exec.LookPath("fusermount")
+	if err != nil { return err }
 
-	process, error := os.StartProcess(fusermountPath, []string{fusermountPath, "-u", path}, &os.ProcAttr{})
-	if error != nil { return error }
+	process, err := os.StartProcess(fusermountPath, []string{fusermountPath, "-u", path}, &os.ProcAttr{})
+	if err != nil { return err }
 
-	message, error := os.Wait(process.Pid, 0)
-	if error != nil { return error }
+	message, err := os.Wait(process.Pid, 0)
+	if err != nil { return err }
 	if message.ExitStatus() != 0 {
 		return errors.New("Could not unmount.")
 	}

File src/main/commands/untag.go

     if args[0] == "--all" {
         if len(args) < 2 { return errors.New("Files to untag must be specified.") }
 
-        error := command.removeFiles(args[1:])
-        if error != nil { return error }
+        err := command.removeFiles(args[1:])
+        if err != nil { return err }
     } else {
         if len(args) < 2 { return errors.New("Tags to remove must be specified.") }
 
-        error := command.untagFile(args[0], args[1:])
-        if error != nil { return error }
+        err := command.untagFile(args[0], args[1:])
+        if err != nil { return err }
     }
 
 
 }
 
 func (UntagCommand) removeFiles(paths []string) error {
-    db, error := OpenDatabase(databasePath())
-    if error != nil {
-        return error
-    }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { return err }
     defer db.Close()
 
     for _, path := range paths {
-        absPath, error := filepath.Abs(path)
-        if error != nil {
-            return error
-        }
+        absPath, err := filepath.Abs(path)
+        if err != nil { return err }
 
-        file, error := db.FileByPath(absPath)
-        if error != nil { return error }
+        file, err := db.FileByPath(absPath)
+        if err != nil { return err }
         if file == nil { return errors.New("File '" + path + "' is not tagged.") }
 
-        error = db.RemoveFileTagsByFileId(file.Id)
-        if error != nil { return error }
+        err = db.RemoveFileTagsByFileId(file.Id)
+        if err != nil { return err }
 
-        error = db.RemoveFile(file.Id)
-        if error != nil { return error }
+        err = db.RemoveFile(file.Id)
+        if err != nil { return err }
     }
 
     return nil
 }
 
 func (command UntagCommand) untagFile(path string, tagNames []string) error {
-	absPath, error := filepath.Abs(path)
-	if error != nil { return error }
+	absPath, err := filepath.Abs(path)
+	if err != nil { return err }
 
-	db, error := OpenDatabase(databasePath())
-	if error != nil { return error }
+	db, err := OpenDatabase(databasePath())
+	if err != nil { return err }
 	defer db.Close()
 
-	file, error := db.FileByPath(absPath)
-	if error != nil { return error }
+	file, err := db.FileByPath(absPath)
+	if err != nil { return err }
 	if file == nil { return errors.New("File '" + path + "' is not tagged.") }
 
     for _, tagName := range tagNames {
-        error = command.unapplyTag(db, path, file.Id, tagName)
-        if error != nil { return error }
+        err = command.unapplyTag(db, path, file.Id, tagName)
+        if err != nil { return err }
     }
 
-	hasTags, error := db.AnyFileTagsForFile(file.Id)
-	if error != nil { return error }
+	hasTags, err := db.AnyFileTagsForFile(file.Id)
+	if err != nil { return err }
 
 	if !hasTags {
-        error := db.RemoveFile(file.Id)
-        if error != nil { return error }
+        err := db.RemoveFile(file.Id)
+        if err != nil { return err }
 	}
 
 	return nil
 }
 
 func (UntagCommand) unapplyTag(db *Database, path string, fileId uint, tagName string) error {
-	tag, error := db.TagByName(tagName)
-	if error != nil {
-		return error
-	}
+	tag, err := db.TagByName(tagName)
+	if err != nil { return err }
 	if tag == nil {
 		errors.New("No such tag" + tagName)
 	}
 
-	fileTag, error := db.FileTagByFileIdAndTagId(fileId, tag.Id)
-	if error != nil {
-		return error
-	}
-	if fileTag == nil {
-		errors.New("File '" + path + "' is not tagged '" + tagName + "'.")
-	}
+	fileTag, err := db.FileTagByFileIdAndTagId(fileId, tag.Id)
+	if err != nil { return err }
+	if fileTag == nil { return errors.New("File '" + path + "' is not tagged '" + tagName + "'.") }
 
 	if fileTag != nil {
-		error := db.RemoveFileTag(fileId, tag.Id)
-		if error != nil {
-			return error
-		}
+		err := db.RemoveFileTag(fileId, tag.Id)
+		if err != nil { return err }
 	} else {
 		return errors.New("File '" + path + "' is not tagged '" + tagName + "'.\n")
 	}

File src/main/commands/vfs.go

 	database := args[0]
 	mountPath := args[1]
 
-	vfs, error := MountVfs(database, mountPath)
-	if error != nil {
-		return error
-	}
+	vfs, err := MountVfs(database, mountPath)
+	if err != nil { return err }
 	defer vfs.Unmount()
 
 	vfs.Loop()

File src/main/config.go

 )
 
 func databasePath() string {
-	path, error := os.Getenverror("TMSU_DB")
-	if error == nil { return path }
+	path, err := os.Getenverror("TMSU_DB")
+	if err == nil { return path }
 
 	//TODO Windows support
-	homePath, error := os.Getenverror("HOME")
-	if error != nil { panic("Could not determine home directory: environment variable 'HOME' does not exist.") }
+	homePath, err := os.Getenverror("HOME")
+	if err != nil { panic("Could not determine home directory: environment variable 'HOME' does not exist.") }
 
 	return filepath.Join(homePath, defaultDatabaseName)
 }

File src/main/database.go

 }
 
 func OpenDatabase(path string) (*Database, error) {
-	connection, error := sql.Open("sqlite3", path)
-	if error != nil { return nil, error }
+	connection, err := sql.Open("sqlite3", path)
+	if err != nil { return nil, err }
 
 	database := Database{connection}
 
-	error = database.CreateSchema()
-	if error != nil { return nil, error }
+	err = database.CreateSchema()
+	if err != nil { return nil, err }
 
 	return &database, nil
 }
 	sql := `SELECT count(1)
 			FROM tag`
 
-	rows, error := db.connection.Query(sql)
-	if error != nil { return 0, error }
+	rows, err := db.connection.Query(sql)
+	if err != nil { return 0, err }
 	defer rows.Close()
 
 	if !rows.Next() { return 0, errors.New("Could not get tag count.") }
-	if rows.Err() != nil { return 0, error }
+	if rows.Err() != nil { return 0, err }
 
 	var count uint
-	error = rows.Scan(&count)
-	if error != nil { return 0, error }
+	err = rows.Scan(&count)
+	if err != nil { return 0, err }
 
 	return count, nil
 }
             FROM tag
             ORDER BY name`
 
-	rows, error := db.connection.Query(sql)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	tags := make([]Tag, 0, 10)
 	for rows.Next() {
-	    if rows.Err() != nil { return nil, error }
+	    if rows.Err() != nil { return nil, err }
 
 		var id uint
 		var name string
-		error = rows.Scan(&id, &name)
-		if error != nil { return nil, error }
+		err = rows.Scan(&id, &name)
+		if err != nil { return nil, err }
 
 		tags = append(tags, Tag{id, name})
 	}
 	        FROM tag
 	        WHERE name = ?`
 
-	rows, error := db.connection.Query(sql, name)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, name)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	if !rows.Next() { return nil, nil }
-	if rows.Err() != nil { return nil, error }
+	if rows.Err() != nil { return nil, err }
 
 	var id uint
-	error = rows.Scan(&id)
-	if error != nil { return nil, error }
+	err = rows.Scan(&id)
+	if err != nil { return nil, err }
 
 	return &Tag{id, name}, nil
 }
             )
             ORDER BY name`
 
-	rows, error := db.connection.Query(sql, fileId)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, fileId)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	tags := make([]Tag, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var tagId uint
 		var tagName string
-		error = rows.Scan(&tagId, &tagName)
-		if error != nil { return nil, error }
+		err = rows.Scan(&tagId, &tagName)
+		if err != nil { return nil, err }
 
 		tags = append(tags, Tag{tagId, tagName})
 	}
 		castTagNames[index] = tagName
 	}
 
-	rows, error := db.connection.Query(sql, castTagNames...)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, castTagNames...)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	tags := make([]Tag, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var tagId uint
 		var tagName string
-		error = rows.Scan(&tagId, &tagName)
-		if error != nil { return nil, error }
+		err = rows.Scan(&tagId, &tagName)
+		if err != nil { return nil, err }
 
 		if !db.contains(tagNames, tagName) {
 			tags = append(tags, Tag{tagId, tagName})
 	sql := `INSERT INTO tag (name)
 	        VALUES (?)`
 
-	result, error := db.connection.Exec(sql, name)
-	if error != nil { return nil, error }
+	result, err := db.connection.Exec(sql, name)
+	if err != nil { return nil, err }
 
-	id, error := result.LastInsertId()
-	if error != nil { return nil, error }
+	id, err := result.LastInsertId()
+	if err != nil { return nil, err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return nil, error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return nil, err }
 	if rowsAffected != 1 { return nil, errors.New("Expected exactly one row to be affected.") }
 
 	return &Tag{uint(id), name}, nil
 	        SET name = ?
 	        WHERE id = ?`
 
-	result, error := db.connection.Exec(sql, name, tagId)
-	if error != nil { return nil, error }
+	result, err := db.connection.Exec(sql, name, tagId)
+	if err != nil { return nil, err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return nil, error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return nil, err }
 	if rowsAffected != 1 { return nil, errors.New("Expected exactly one row to be affected.") }
 
 	return &Tag{tagId, name}, nil
 	sql := `DELETE FROM tag
 	        WHERE id = ?`
 
-	result, error := db.connection.Exec(sql, tagId)
-	if error != nil { return error }
+	result, err := db.connection.Exec(sql, tagId)
+	if err != nil { return err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return err }
 	if rowsAffected != 1 { return errors.New("Expected exactly one row to be affected.") }
 
 	return nil
 	sql := `SELECT count(1)
 			FROM file`
 
-	rows, error := db.connection.Query(sql)
-	if error != nil { return 0, error }
+	rows, err := db.connection.Query(sql)
+	if err != nil { return 0, err }
 	defer rows.Close()
 
 	if !rows.Next() { return 0, errors.New("Could not get file count.") }
-	if rows.Err() != nil { return 0, error }
+	if rows.Err() != nil { return 0, err }
 
 	var count uint
-	error = rows.Scan(&count)
-	if error != nil { return 0, error }
+	err = rows.Scan(&count)
+	if err != nil { return 0, err }
 
 	return count, nil
 }
 	sql := `SELECT id, directory, name, fingerprint
 	        FROM file`
 
-	rows, error := db.connection.Query(sql)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	files := make([]File, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var fileId uint
 		var directory string
 		var name string
 		var fingerprint string
-		error = rows.Scan(&fileId, &directory, &name, &fingerprint)
-		if error != nil { return nil, error }
+		err = rows.Scan(&fileId, &directory, &name, &fingerprint)
+		if err != nil { return nil, err }
 
 		files = append(files, File{fileId, directory, name, fingerprint})
 	}
 	        FROM file
 	        WHERE id = ?`
 
-	rows, error := db.connection.Query(sql, id)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, id)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	if !rows.Next() { return nil, nil }
-	if rows.Err() != nil { return nil, error }
+	if rows.Err() != nil { return nil, err }
 
 	var directory string
 	var name string
 	var fingerprint string
-	error = rows.Scan(&directory, &name, &fingerprint)
-	if error != nil { return nil, error }
+	err = rows.Scan(&directory, &name, &fingerprint)
+	if err != nil { return nil, err }
 
 	return &File{id, directory, name, fingerprint}, nil
 }
 	        FROM file
 	        WHERE directory = ? AND name = ?`
 
-	rows, error := db.connection.Query(sql, directory, name)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, directory, name)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	if !rows.Next() { return nil, nil }
-	if rows.Err() != nil { return nil, error }
+	if rows.Err() != nil { return nil, err }
 
 	var id uint
 	var fingerprint string
-	error = rows.Scan(&id, &fingerprint)
-	if error != nil { return nil, error }
+	err = rows.Scan(&id, &fingerprint)
+	if err != nil { return nil, err }
 
 	return &File{id, directory, name, fingerprint}, nil
 }
 	        FROM file
 	        WHERE directory = ? OR directory like ?`
 
-	rows, error := db.connection.Query(sql, directory, directory + "/%")
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, directory, directory + "/%")
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	files := make([]File, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var fileId uint
 		var dir string
 		var name string
 		var fingerprint string
-		error = rows.Scan(&fileId, &dir, &name, &fingerprint)
-		if error != nil { return nil, error }
+		err = rows.Scan(&fileId, &dir, &name, &fingerprint)
+		if err != nil { return nil, err }
 
 		files = append(files, File{fileId, dir, name, fingerprint})
 	}
 	        FROM file
 	        WHERE fingerprint = ?`
 
-	rows, error := db.connection.Query(sql, fingerprint)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, fingerprint)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	files := make([]File, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var fileId uint
 		var directory string
 		var name string
-		error = rows.Scan(&fileId, &directory, &name)
-		if error != nil { return nil, error }
+		err = rows.Scan(&fileId, &directory, &name)
+		if err != nil { return nil, err }
 
 		files = append(files, File{fileId, directory, name, fingerprint})
 	}
                                 HAVING count(1) > 1)
             ORDER BY fingerprint`
 
-	rows, error := db.connection.Query(sql)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
     fileSets := make([][]File, 0, 10)
     var previousFingerprint string
 
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var fileId uint
 		var directory string
 		var name string
 		var fingerprint string
-		error = rows.Scan(&fileId, &directory, &name, &fingerprint)
-		if error != nil { return nil, error }
+		err = rows.Scan(&fileId, &directory, &name, &fingerprint)
+		if err != nil { return nil, err }
 
 	    if fingerprint != previousFingerprint {
 	        if fileSet != nil { fileSets = append(fileSets, fileSet) }
 	sql := `INSERT INTO file (directory, name, fingerprint)
 	        VALUES (?, ?, ?)`
 
-	result, error := db.connection.Exec(sql, directory, name, fingerprint)
-	if error != nil { return nil, error }
+	result, err := db.connection.Exec(sql, directory, name, fingerprint)
+	if err != nil { return nil, err }
 
-	id, error := result.LastInsertId()
-	if error != nil { return nil, error }
+	id, err := result.LastInsertId()
+	if err != nil { return nil, err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return nil, error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return nil, err }
 	if rowsAffected != 1 { return nil, errors.New("Expected exactly one row to be affected.") }
 
 	return &File{uint(id), directory, name, fingerprint}, nil
 		castTagNames[index] = tagName
 	}
 
-	rows, error := db.connection.Query(sql, castTagNames...)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, castTagNames...)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	files := make([]File, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var fileId uint
 		var directory string
 		var name string
 		var fingerprint string
-		error = rows.Scan(&fileId, &directory, &name, &fingerprint)
-		if error != nil { return nil, error }
+		err = rows.Scan(&fileId, &directory, &name, &fingerprint)
+		if err != nil { return nil, err }
 
 		files = append(files, File{fileId, directory, name, fingerprint})
 	}
 	        SET fingerprint = ?
 	        WHERE id = ?`
 
-	_, error := db.connection.Exec(sql, fingerprint, int(fileId))
-	if error != nil { return error }
+	_, err := db.connection.Exec(sql, fingerprint, int(fileId))
+	if err != nil { return err }
 
 	return nil
 }
 	sql := `DELETE FROM file
 	        WHERE id = ?`
 
-	result, error := db.connection.Exec(sql, fileId)
-	if error != nil { return error }
+	result, err := db.connection.Exec(sql, fileId)
+	if err != nil { return err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return err }
 	if rowsAffected != 1 { return errors.New("Expected exactly one row to be affected.") }
 
 	return nil
 	sql := `SELECT count(1)
 			FROM file_tag`
 
-	rows, error := db.connection.Query(sql)
-	if error != nil { return 0, error }
+	rows, err := db.connection.Query(sql)
+	if err != nil { return 0, err }
 	defer rows.Close()
 
 	if !rows.Next() { return 0, errors.New("Could not get file-tag count.") }
-	if rows.Err() != nil { return 0, error }
+	if rows.Err() != nil { return 0, err }
 
 	var count uint
-	error = rows.Scan(&count)
-	if error != nil { return 0, error }
+	err = rows.Scan(&count)
+	if err != nil { return 0, err }
 
 	return count, nil
 }
 	sql := `SELECT id, file_id, tag_id
 	        FROM file_tag`
 
-	rows, error := db.connection.Query(sql)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	fileTags := make([]FileTag, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var fileTagId uint
 		var fileId uint
 		var tagId uint
-		error = rows.Scan(&fileTagId, &fileId, &tagId)
-		if error != nil { return nil, error }
+		err = rows.Scan(&fileTagId, &fileId, &tagId)
+		if err != nil { return nil, err }
 
 		fileTags = append(fileTags, FileTag{fileTagId, fileId, tagId})
 	}
 	        WHERE file_id = ?
 	        AND tag_id = ?`
 
-	rows, error := db.connection.Query(sql, fileId, tagId)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, fileId, tagId)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	if !rows.Next() { return nil, nil }
-	if rows.Err() != nil { return nil, error }
+	if rows.Err() != nil { return nil, err }
 
 	var fileTagId uint
-	error = rows.Scan(&fileTagId)
-    if error != nil { return nil, error }
+	err = rows.Scan(&fileTagId)
+    if err != nil { return nil, err }
 
 	return &FileTag{fileTagId, fileId, tagId}, nil
 }
 	        FROM file_tag
 	        WHERE tag_id = ?`
 
-	rows, error := db.connection.Query(sql, tagId)
-	if error != nil { return nil, error }
+	rows, err := db.connection.Query(sql, tagId)
+	if err != nil { return nil, err }
 	defer rows.Close()
 
 	fileTags := make([]FileTag, 0, 10)
 	for rows.Next() {
-        if rows.Err() != nil { return nil, error }
+        if rows.Err() != nil { return nil, err }
 
 		var fileTagId uint
 		var fileId uint
-		error = rows.Scan(&fileTagId, &fileId)
-		if error != nil { return nil, error }
+		err = rows.Scan(&fileTagId, &fileId)
+		if err != nil { return nil, err }
 
 		fileTags = append(fileTags, FileTag{fileTagId, fileId, tagId})
 	}
             WHERE file_id = ?
             LIMIT 1`
 
-	rows, error := db.connection.Query(sql, fileId)
-	if error != nil { return false, error }
+	rows, err := db.connection.Query(sql, fileId)
+	if err != nil { return false, err }
 	defer rows.Close()
 
     if rows.Next() { return true, nil }
-	if rows.Err() != nil { return false, error }
+	if rows.Err() != nil { return false, err }
 
     return false, nil
 }
 	sql := `INSERT INTO file_tag (file_id, tag_id)
 	        VALUES (?, ?)`
 
-	result, error := db.connection.Exec(sql, fileId, tagId)
-	if error != nil { return nil, error }
+	result, err := db.connection.Exec(sql, fileId, tagId)
+	if err != nil { return nil, err }
 
-	id, error := result.LastInsertId()
-	if error != nil { return nil, error }
+	id, err := result.LastInsertId()
+	if err != nil { return nil, err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return nil, error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return nil, err }
 	if rowsAffected != 1 { return nil, errors.New("Expected exactly one row to be affected.") }
 
 	return &FileTag{uint(id), fileId, tagId}, nil
 	        WHERE file_id = ?
 	        AND tag_id = ?`
 
-	result, error := db.connection.Exec(sql, fileId, tagId)
-	if error != nil { return error }
+	result, err := db.connection.Exec(sql, fileId, tagId)
+	if err != nil { return err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return err }
 	if rowsAffected != 1 { return errors.New("Expected exactly one row to be affected.") }
 
 	return nil
 	sql := `DELETE FROM file_tag
 	        WHERE file_id = ?`
 
-	_, error := db.connection.Exec(sql, fileId)
-	if error != nil { return error }
+	_, err := db.connection.Exec(sql, fileId)
+	if err != nil { return err }
 
 	return nil
 }
 	sql := `DELETE FROM file_tag
 	        WHERE tag_id = ?`
 
-	_, error := db.connection.Exec(sql, tagId)
-	if error != nil { return error }
+	_, err := db.connection.Exec(sql, tagId)
+	if err != nil { return err }
 
 	return nil
 }
 	        SET tag_id = ?
 	        WHERE tag_id = ?`
 
-	result, error := db.connection.Exec(sql, newTagId, oldTagId)
-	if error != nil { return error }
+	result, err := db.connection.Exec(sql, newTagId, oldTagId)
+	if err != nil { return err }
 
-	rowsAffected, error := result.RowsAffected()
-	if error != nil { return error }
+	rowsAffected, err := result.RowsAffected()
+	if err != nil { return err }
 	if rowsAffected != 1 { return errors.New("Expected exactly one row to be affected.") }
 
 	return nil
                 name TEXT NOT NULL
             )`
 
-	_, error := db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err := db.connection.Exec(sql)
+	if err != nil { return err }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_tag_name
            ON tag(name)`
 
-	_, error = db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err = db.connection.Exec(sql)
+	if err != nil { return err }
 
     sql = `CREATE TABLE IF NOT EXISTS file (
                id INTEGER PRIMARY KEY,
                CONSTRAINT con_file_path UNIQUE (directory, name)
            )`
 
-	_, error = db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err = db.connection.Exec(sql)
+	if err != nil { return err }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_fingerprint
            ON file(fingerprint)`
 
-	_, error = db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err = db.connection.Exec(sql)
+	if err != nil { return err }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_path
            ON file(directory, name)`
 
-	_, error = db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err = db.connection.Exec(sql)
+	if err != nil { return err }
 
     sql = `CREATE TABLE IF NOT EXISTS file_tag (
                id INTEGER PRIMARY KEY,
                FOREIGN KEY (tag_id) REFERENCES tag(id)
            )`
 
-	_, error = db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err = db.connection.Exec(sql)
+	if err != nil { return err }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_tag_file_id
            ON file_tag(file_id)`
 
-	_, error = db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err = db.connection.Exec(sql)
+	if err != nil { return err }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_tag_tag_id
            ON file_tag(tag_id)`
 
-	_, error = db.connection.Exec(sql)
-	if error != nil { return error }
+	_, err = db.connection.Exec(sql)
+	if err != nil { return err }
 
 	return nil
 }

File src/main/fingerprinter.go

 )
 
 func Fingerprint(path string) (string, error) {
-	file, error := os.Open(path)
-	if error != nil { return "", error }
+	file, err := os.Open(path)
+	if err != nil { return "", err }
 	defer file.Close()
 
 	hash := sha256.New()
 
 	buffer := make([]byte, 1024)
-	for count := 0; error == nil; count, error = file.Read(buffer) {
+	for count := 0; err == nil; count, err = file.Read(buffer) {
 		hash.Write(buffer[:count])
 	}
 

File src/main/fusevfs.go

 func MountVfs(databasePath string, mountPath string) (*FuseVfs, error) {
 	fuseVfs := FuseVfs{}
     pathNodeFs := fuse.NewPathNodeFs(&fuseVfs, nil)
-	state, _, error := fuse.MountNodeFileSystem(mountPath, pathNodeFs, nil)
-	if error != nil { return nil, error }
+	state, _, err := fuse.MountNodeFileSystem(mountPath, pathNodeFs, nil)
+	if err != nil { return nil, err }
 
 	fuseVfs.databasePath = databasePath
 	fuseVfs.mountPath = mountPath
 }
 
 func (vfs FuseVfs) Unlink(name string, context *fuse.Context) fuse.Status {
-    fileId, error := vfs.parseFileId(name)
-    if error != nil { log.Fatalf("Could not unlink: %v", error) }
+    fileId, err := vfs.parseFileId(name)
+    if err != nil { log.Fatalf("Could not unlink: %v", err) }
 
     if fileId == 0 {
         // cannot unlink tag directories
     path := vfs.splitPath(name)
     tagNames := path[1:len(path) - 1]
 
-    db, error := OpenDatabase(databasePath())
-    if error != nil { log.Fatal(error) }
+    db, err := OpenDatabase(databasePath())
+    if err != nil { log.Fatal(err) }
 
     for _, tagName := range tagNames {
-        tag, error := db.TagByName(tagName)
-        if error != nil { log.Fatal(error) }
+        tag, err := db.TagByName(tagName)
+        if err != nil { log.Fatal(err) }
         if tag == nil { log.Fatalf("Could not retrieve tag '%v'.", tagName) }
 
-        error = db.RemoveFileTag(fileId, tag.Id)
-        if error != nil { log.Fatal(error) }
+        err = db.RemoveFileTag(fileId, tag.Id)
+        if err != nil { log.Fatal(err) }
     }
 
     return fuse.OK
 
 	if count == 1 { return 0, nil }
 
-	id, error := Atoui(parts[count - 2])
-	if error != nil { id, error = Atoui(parts[count - 1]) }
-	if error != nil { return 0, nil }
+	id, err := Atoui(parts[count - 2])
+	if err != nil { id, err = Atoui(parts[count - 1]) }
+	if err != nil { return 0, nil }
 
 	return id, nil
 }
 }
 
 func (vfs FuseVfs) tagDirectories() (chan fuse.DirEntry, fuse.Status) {
-	db, error := OpenDatabase(vfs.databasePath)
-	if error != nil { log.Fatal("Could not open database: %v", error) }
+	db, err := OpenDatabase(vfs.databasePath)
+	if err != nil { log.Fatal("Could not open database: %v", err) }
 	defer db.Close()
 
-	tags, error := db.Tags()
-	if error != nil { log.Fatal("Could not retrieve tags: %v", error) }
+	tags, err := db.Tags()
+	if err != nil { log.Fatal("Could not retrieve tags: %v", err) }
 
 	channel := make(chan fuse.DirEntry, len(tags))
 	for _, tag := range tags {
 	pathLength := len(path)
 	name := path[pathLength-1]
 
-	fileId, error := vfs.parseFileId(name)
-	if error != nil { return nil, fuse.ENOENT }
+	fileId, err := vfs.parseFileId(name)
+	if err != nil { return nil, fuse.ENOENT }
 
 	if fileId == 0 {
 	    // if no file ID then it is a tag directory
 		return &fuse.Attr{Mode: fuse.S_IFDIR | 0755}, fuse.OK
 	}
 
-	db, error := OpenDatabase(vfs.databasePath)
-	if error != nil { log.Fatalf("Could not open database: %v", error) }
+	db, err := OpenDatabase(vfs.databasePath)
+	if err != nil { log.Fatalf("Could not open database: %v", err) }
 	defer db.Close()
 
-    file, error := db.File(fileId)
-    if error != nil { log.Fatalf("Could not retrieve file #%v: %v", fileId, error) }
+    file, err := db.File(fileId)
+    if err != nil { log.Fatalf("Could not retrieve file #%v: %v", fileId, err) }
     if file == nil { return &fuse.Attr{Mode: fuse.S_IFREG}, fuse.ENOENT }
 
-    fileInfo, error := os.Stat(file.Path())
+    fileInfo, err := os.Stat(file.Path())
     var size int64
-    if error == nil {
+    if err == nil {
         size = fileInfo.Size()
     } else {
         size = 0
 }
 
 func (vfs FuseVfs) openTaggedEntryDir(path []string) (chan fuse.DirEntry, fuse.Status) {
-	db, error := OpenDatabase(vfs.databasePath)
-	if error != nil { log.Fatalf("Could not open database: %v", error) }
+	db, err := OpenDatabase(vfs.databasePath)
+	if err != nil { log.Fatalf("Could not open database: %v", err) }
 	defer db.Close()
 
 	tags := path
 
-	furtherTags, error := db.TagsForTags(tags)
-	if error != nil { log.Fatalf("Could not retrieve tags for tags: %v", error) }
+	furtherTags, err := db.TagsForTags(tags)
+	if err != nil { log.Fatalf("Could not retrieve tags for tags: %v", err) }
 
-	files, error := db.FilesWithTags(tags)
-	if error != nil { log.Fatalf("Could not retrieve tagged files: %v", error) }
+	files, err := db.FilesWithTags(tags)
+	if err != nil { log.Fatalf("Could not retrieve tagged files: %v", err) }
 
 	channel := make(chan fuse.DirEntry, len(files) + len(furtherTags))
 	defer close(channel)
 func (vfs FuseVfs) readTaggedEntryLink(path []string) (string, fuse.Status) {
 	name := path[len(path)-1]
 
-	db, error := OpenDatabase(vfs.databasePath)
-	if error != nil { log.Fatalf("Could not open database: %v", error) }
+	db, err := OpenDatabase(vfs.databasePath)
+	if err != nil { log.Fatalf("Could not open database: %v", err) }
 	defer db.Close()
 
-	fileId, error := vfs.parseFileId(name)
-	if error != nil { log.Fatalf("Could not parse file identifier: %v", error) }
+	fileId, err := vfs.parseFileId(name)
+	if err != nil { log.Fatalf("Could not parse file identifier: %v", err) }
 	if fileId == 0 { return "", fuse.ENOENT }
 
-	file, error := db.File(fileId)
-	if error != nil { log.Fatalf("Could not find file %v in database.", fileId) }
+	file, err := db.File(fileId)
+	if err != nil { log.Fatalf("Could not find file %v in database.", fileId) }
 
 	return file.Path(), fuse.OK
 }
 }
 
 func Atoui(str string) (uint, error) {
-    ui64, error := strconv.ParseUint(str, 10, 0)
-    return uint(ui64), error
+    ui64, err := strconv.ParseUint(str, 10, 0)
+    return uint(ui64), err
 }

File src/main/main.go

 		args = []string{}
 	}
 
-	error := command.Exec(args)
-	if error != nil {
-	    fmt.Fprintln(os.Stderr, error.Error())
+	err := command.Exec(args)
+	if err != nil {
+	    fmt.Fprintln(os.Stderr, err.Error())
 	    os.Exit(1)
 	}
 }

File src/main/os.go

 }
 
 func directoryEntries(path string) ([]string, error) {
-    file, error := os.Open(path)
-    if error != nil { return nil, error }
+    file, err := os.Open(path)
+    if err != nil { return nil, err }
     defer file.Close()
 
-    entryNames, error := file.Readdirnames(0)
-    if error != nil { return nil, error }
+    entryNames, err := file.Readdirnames(0)
+    if err != nil { return nil, err }
 
     entryPaths := make([]string, len(entryNames))
     for index, entryName := range entryNames {