Commits

Paul Ruane committed 505fcad

Replaced use of 'this' for struct name in methods.

Comments (0)

Files changed (18)

src/main/commands/delete.go

 
 type DeleteCommand struct{}
 
-func (this DeleteCommand) Name() string {
+func (DeleteCommand) Name() string {
 	return "delete"
 }
 
-func (this DeleteCommand) Summary() string {
+func (DeleteCommand) Summary() string {
 	return "deletes one or more tags"
 }
 
-func (this DeleteCommand) Help() string {
+func (DeleteCommand) Help() string {
 	return `tmsu delete TAG...
 
 Permanently deletes the tag(s) specified.`
 }
 
-func (this DeleteCommand) Exec(args []string) error {
+func (command DeleteCommand) Exec(args []string) error {
 	if len(args) == 0 {
 		return errors.New("No tags to delete specified.")
 	}
 	defer db.Close()
 
 	for _, tagName := range args {
-		error = this.deleteTag(db, tagName)
+		error = command.deleteTag(db, tagName)
 		if error != nil { return error }
 	}
 
 	return nil
 }
 
-func (this DeleteCommand) deleteTag(db *Database, tagName string) error {
+func (DeleteCommand) deleteTag(db *Database, tagName string) error {
 	tag, error := db.TagByName(tagName)
 	if error != nil { return error }
 

src/main/commands/dupes.go

 
 type DupesCommand struct{}
 
-func (this DupesCommand) Name() string {
+func (DupesCommand) Name() string {
 	return "dupes"
 }
 
-func (this DupesCommand) Summary() string {
+func (DupesCommand) Summary() string {
 	return "identifies any duplicate files"
 }
 
-func (this DupesCommand) Help() string {
+func (DupesCommand) Help() string {
 	return `  tmsu dupes [FILE]
 
 Identifies all files in the database that are exact duplicates of FILE.
 When FILE is omitted duplicates within the database are identified.`
 }
 
-func (this DupesCommand) Exec(args []string) error {
+func (command DupesCommand) Exec(args []string) error {
     argCount := len(args)
     if argCount > 1 { errors.New("Only a single file can be specified.") }
 
     switch argCount {
-        case 0: return this.findDuplicates()
-        case 1: return this.findDuplicatesOf(args[0])
+        case 0: return command.findDuplicates()
+        case 1: return command.findDuplicatesOf(args[0])
     }
 
 	return nil
 }
 
-// implementation
-
-func (this DupesCommand) findDuplicates() error {
+func (DupesCommand) findDuplicates() error {
     db, error := OpenDatabase(databasePath())
     if error != nil { return error }
     defer db.Close()
     return nil
 }
 
-func (this DupesCommand) findDuplicatesOf(path string) error {
+func (DupesCommand) findDuplicatesOf(path string) error {
     db, error := OpenDatabase(databasePath())
     if error != nil { return error }
     defer db.Close()

src/main/commands/export.go

 
 type ExportCommand struct{}
 
-func (this ExportCommand) Name() string {
+func (ExportCommand) Name() string {
 	return "export"
 }
 
-func (this ExportCommand) Summary() string {
+func (ExportCommand) Summary() string {
 	return "exports the tag database"
 }
 
-func (this ExportCommand) Help() string {
+func (ExportCommand) Help() string {
 	return `tmsu export
         
 dumps the tag database to standard output as comma-separated values (CSV)`
 }
 
-func (this ExportCommand) Exec(args []string) error {
+func (command ExportCommand) Exec(args []string) error {
 	if len(args) != 0 {
-		return errors.New("Unpected argument to command '" + this.Name() + "'.")
+		return errors.New("Unpected argument to command '" + command.Name() + "'.")
 	}
 
 	db, error := OpenDatabase(databasePath())

src/main/commands/files.go

 
 type FilesCommand struct{}
 
-func (this FilesCommand) Name() string {
+func (FilesCommand) Name() string {
 	return "files"
 }
 
-func (this FilesCommand) Summary() string {
+func (FilesCommand) Summary() string {
 	return "lists files with particular tags"
 }
 
-func (this FilesCommand) Help() string {
+func (FilesCommand) Help() string {
 	return `  tmsu files TAG...
   tmsu files --all
 
   --all    show the complete set of tagged files`
 }
 
-func (this FilesCommand) Exec(args []string) error {
+func (command FilesCommand) Exec(args []string) error {
     argCount := len(args)
 
     if argCount == 1 && args[0] == "--all" {
-        return this.listAllFiles()
+        return command.listAllFiles()
     }
 
-    return this.listFiles(args)
+    return command.listFiles(args)
 }
 
-func (this FilesCommand) listAllFiles() error {
+func (FilesCommand) listAllFiles() error {
     db, error := OpenDatabase(databasePath())
     if error != nil { return error }
     defer db.Close()
     return nil
 }
 
-func (this FilesCommand) listFiles(tagNames []string) error {
+func (FilesCommand) listFiles(tagNames []string) error {
     if len(tagNames) == 0 { return errors.New("At least one tag must be specified.") }
 
     db, error := OpenDatabase(databasePath())

src/main/commands/help.go

 
 type HelpCommand struct{}
 
-func (this HelpCommand) Name() string {
+func (HelpCommand) Name() string {
 	return "help"
 }
 
-func (this HelpCommand) Summary() string {
+func (HelpCommand) Summary() string {
 	return "lists commands or provides help for a particular command"
 }
 
-func (this HelpCommand) Help() string {
+func (HelpCommand) Help() string {
 	return `  tmsu help          lists commands
   tmsu help COMMAND  shows help for COMMAND
 
 Shows command summary or, when a command is specified, detailed help for that command.`
 }
 
-func (this HelpCommand) Exec(args []string) error {
+func (command HelpCommand) Exec(args []string) error {
 	switch len(args) {
 	case 0:
-		this.overview()
+		command.overview()
 	default:
-		this.commandHelp(args[0])
+		command.commandHelp(args[0])
 	}
 
 	return nil
 }
 
-// implementation
-
-func (this HelpCommand) overview() {
+func (HelpCommand) overview() {
 	fmt.Println("tmsu")
 	fmt.Println()
 
 	}
 }
 
-func (this HelpCommand) commandHelp(commandName string) {
+func (HelpCommand) commandHelp(commandName string) {
 	command := commands[commandName]
 	if command == nil {
 		fmt.Printf("No such command '%v'.\n", commandName)

src/main/commands/merge.go

 
 type MergeCommand struct{}
 
-func (this MergeCommand) Name() string {
+func (MergeCommand) Name() string {
 	return "merge"
 }
 
-func (this MergeCommand) Summary() string {
+func (MergeCommand) Summary() string {
 	return "merges two tags together"
 }
 
-func (this MergeCommand) Help() string {
+func (MergeCommand) Help() string {
 	return `  tmsu merge SRC DEST
         
 Merges SRC into DEST resulting in a single tag of name DEST.`
 }
 
-func (this MergeCommand) Exec(args []string) error {
+func (MergeCommand) Exec(args []string) error {
 	db, error := OpenDatabase(databasePath())
 	if error != nil { return error }
 	//defer db.Close()

src/main/commands/mount.go

 	"time"
 )
 
-const HALF_SECOND = 500000000
-
 type MountCommand struct{}
 
-func (this MountCommand) Name() string {
+func (MountCommand) Name() string {
 	return "mount"
 }
 
-func (this MountCommand) Summary() string {
+func (MountCommand) Summary() string {
 	return "mounts the virtual file-system"
 }
 
-func (this MountCommand) Help() string {
+func (MountCommand) Help() string {
 	return `  tmsu mount MOUNTPOINT
 
 Mounts the virtual file-system (VFS) at the mountpoint directory specified.
 The default database at '$HOME/.tmsu/db' will be mounted unless overridden with the 'TMSU_DB' environment variable.`
 }
 
-func (this MountCommand) Exec(args []string) error {
+func (MountCommand) Exec(args []string) error {
 	if len(args) < 1 { errors.New("No mountpoint specified.") }
 	if len(args) > 1 { errors.New("Extraneous arguments.") }
 
 	error = command.Start()
 	if error != nil { return error }
 
+    const HALF_SECOND = 500000000
     time.Sleep(HALF_SECOND)
 
     waitMessage, error := command.Process.Wait(os.WNOHANG)

src/main/commands/rename.go

 
 type RenameCommand struct{}
 
-func (this RenameCommand) Name() string {
+func (RenameCommand) Name() string {
 	return "rename"
 }
 
-func (this RenameCommand) Summary() string {
+func (RenameCommand) Summary() string {
 	return "renames a tag"
 }
 
-func (this RenameCommand) Help() string {
+func (RenameCommand) Help() string {
 	return `  tmsu rename OLD NEW
 
 Renames a tag from OLD to NEW.
 To merge tags use the 'merge' command instead.`
 }
 
-func (this RenameCommand) Exec(args []string) error {
+func (RenameCommand) Exec(args []string) error {
 	db, error := OpenDatabase(databasePath())
 	if error != nil { return error }
 	defer db.Close()

src/main/commands/stats.go

 
 type StatsCommand struct {}
 
-func (this StatsCommand) Name() string {
+func (StatsCommand) Name() string {
     return "stats"
 }
 
-func (this StatsCommand) Summary() string {
+func (StatsCommand) Summary() string {
     return "shows database statistics"
 }
 
-func (this StatsCommand) Help() string {
+func (StatsCommand) Help() string {
     return `tmsu stats
 tmsu stats
 
 Shows the database statistics.`
 }
 
-func (this StatsCommand) Exec(args []string) error {
+func (StatsCommand) Exec(args []string) error {
     db, error := OpenDatabase(databasePath())
     if error != nil { return error }
     defer db.Close()

src/main/commands/status.go

 
 type StatusCommand struct {}
 
-func (this StatusCommand) Name() string {
+func (StatusCommand) Name() string {
     return "status"
 }
 
-func (this StatusCommand) Summary() string {
+func (StatusCommand) Summary() string {
     return "lists file status"
 }
 
-func (this StatusCommand) Help() string {
+func (StatusCommand) Help() string {
     return `tmsu status
 tmsu status FILE...
 
 Shows the status of files.`
 }
 
-func (this StatusCommand) Exec(args []string) error {
+func (command StatusCommand) Exec(args []string) error {
     tagged := make([]string, 0, 10)
     untagged := make([]string, 0, 10)
     missing := make([]string, 0, 10)
     }
 
     if len(args) == 0 {
-        tagged, untagged, missing, error = this.status([]string { "." }, tagged, untagged, missing, allFiles)
+        tagged, untagged, missing, error = command.status([]string { "." }, tagged, untagged, missing, allFiles)
     } else {
-        tagged, untagged, missing, error = this.status(args, tagged, untagged, missing, allFiles)
+        tagged, untagged, missing, error = command.status(args, tagged, untagged, missing, allFiles)
     }
 
     if error != nil { return error }
     return nil
 }
 
-func (this StatusCommand) status(paths []string, tagged []string, untagged []string, missing []string, allFiles bool) ([]string, []string, []string, error) {
+func (command StatusCommand) status(paths []string, tagged []string, untagged []string, missing []string, allFiles bool) ([]string, []string, []string, error) {
     for _, path := range paths {
-        databaseEntries, error := this.getDatabaseEntries(path)
+        databaseEntries, error := command.getDatabaseEntries(path)
         if error != nil { return nil, nil, nil, error }
 
-        fileSystemEntries, error := this.getFileSystemEntries(path, allFiles)
+        fileSystemEntries, error := command.getFileSystemEntries(path, allFiles)
         if error != nil { return nil, nil, nil, error }
 
         for _, entry := range databaseEntries {
     return tagged, untagged, missing, nil
 }
 
-func (this StatusCommand) getFileSystemEntries(path string, allFiles bool) ([]string, error) {
-    return this.getFileSystemEntriesRecursive(path, make([]string, 0, 10), allFiles)
+func (command StatusCommand) getFileSystemEntries(path string, allFiles bool) ([]string, error) {
+    return command.getFileSystemEntriesRecursive(path, make([]string, 0, 10), allFiles)
 }
 
-func (this StatusCommand) getFileSystemEntriesRecursive(path string, entries []string, allFiles bool) ([]string, error) {
+func (command StatusCommand) getFileSystemEntriesRecursive(path string, entries []string, allFiles bool) ([]string, error) {
     fileInfo, error := os.Lstat(path)
     if error != nil { return nil, error }
 
             if error != nil { return nil, error }
 
             for _, entry := range childEntries {
-                entries, error = this.getFileSystemEntriesRecursive(entry, entries, allFiles)
+                entries, error = command.getFileSystemEntriesRecursive(entry, entries, allFiles)
                 if error != nil { return nil, error }
             }
         }
     return entries, nil
 }
 
-func (this StatusCommand) getDatabaseEntries(path string) ([]string, error) {
+func (StatusCommand) getDatabaseEntries(path string) ([]string, error) {
     db, error := OpenDatabase(databasePath())
     if error != nil { return nil, error }
     defer db.Close()

src/main/commands/tag.go

 
 type TagCommand struct{}
 
-func (this TagCommand) Name() string {
+func (TagCommand) Name() string {
 	return "tag"
 }
 
-func (this TagCommand) Summary() string {
+func (TagCommand) Summary() string {
 	return "applies one or more tags to a file"
 }
 
-func (this TagCommand) Help() string {
+func (TagCommand) Help() string {
 	return `  tmsu tag FILE TAG...
 
 Tags the file FILE with the tag(s) specified.`
 }
 
-func (this TagCommand) Exec(args []string) error {
+func (command TagCommand) Exec(args []string) error {
 	if len(args) < 2 {
 		return errors.New("File to tag and tags to apply must be specified.")
 	}
 
-	error := this.tagPath(args[0], args[1:])
+	error := command.tagPath(args[0], args[1:])
 	if error != nil { return error }
 
 	return nil
 }
 
-// implementation
-
-func (this TagCommand) tagPath(path string, tagNames []string) error {
+func (command TagCommand) tagPath(path string, tagNames []string) error {
 	db, error := OpenDatabase(databasePath())
 	if error != nil { return error }
 	defer db.Close()
 	absPath, error := filepath.Abs(path)
 	if error != nil { return error }
 
-	file, error := this.addFile(db, absPath)
+	file, error := command.addFile(db, absPath)
 	if error != nil { return error }
 
 	for _, tagName := range tagNames {
-		_, _, error = this.applyTag(db, path, file.Id, tagName)
+		_, _, error = command.applyTag(db, path, file.Id, tagName)
 		if error != nil { return error }
 	}
 
 	return nil
 }
 
-func (this TagCommand) applyTag(db *Database, path string, fileId uint, tagName string) (*Tag, *FileTag, error) {
+func (TagCommand) applyTag(db *Database, path string, fileId uint, tagName string) (*Tag, *FileTag, error) {
 	if strings.Index(tagName, ",") != -1 {
 	    return nil, nil, errors.New("Tag names cannot contain commas.")
     }
 	return tag, fileTag, nil
 }
 
-func (this TagCommand) addFile(db *Database, path string) (*File, error) {
+func (TagCommand) addFile(db *Database, path string) (*File, error) {
 	fingerprint, error := Fingerprint(path)
 	if error != nil { return nil, error }
 

src/main/commands/tags.go

 
 type TagsCommand struct{}
 
-func (this TagsCommand) Name() string {
+func (TagsCommand) Name() string {
 	return "tags"
 }
 
-func (this TagsCommand) Summary() string {
+func (TagsCommand) Summary() string {
 	return "lists all tags or tags applied to files"
 }
 
-func (this TagsCommand) Help() string {
+func (TagsCommand) Help() string {
 	return `  tmsu tags [FILE]...
   tmsu tags --all
 
   --all    show the complete set of tags`
 }
 
-func (this TagsCommand) Exec(args []string) error {
+func (command TagsCommand) Exec(args []string) error {
     argCount := len(args)
 
     if argCount == 1 && args[0] == "--all" {
-        return this.listAllTags()
+        return command.listAllTags()
     }
 
-	return this.listTags(args)
+	return command.listTags(args)
 }
 
-func (this TagsCommand) listAllTags() error {
+func (TagsCommand) listAllTags() error {
 	db, error := OpenDatabase(databasePath())
 	if error != nil { return error }
 	defer db.Close()
 	return nil
 }
 
-func (this TagsCommand) listTags(paths []string) error {
+func (command TagsCommand) listTags(paths []string) error {
 	db, error := OpenDatabase(databasePath())
 	if error != nil { return error }
 	defer db.Close()
 
     switch len(paths) {
         case 0:
-            return this.listTagsRecursive(db, []string { "." })
+            return command.listTagsRecursive(db, []string { "." })
         case 1:
-            return this.listTagsForPath(db, paths[0])
+            return command.listTagsForPath(db, paths[0])
         default:
-            return this.listTagsRecursive(db, paths)
+            return command.listTagsRecursive(db, paths)
     }
 
-    return this.listTagsRecursive(db, paths)
+    return command.listTagsRecursive(db, paths)
 }
 
-func (this TagsCommand) listTagsForPath(db *Database, path string) error {
-    tags, error := this.tagsForPath(db, path)
+func (command TagsCommand) listTagsForPath(db *Database, path string) error {
+    tags, error := command.tagsForPath(db, path)
     if error != nil { return error }
 
     for _, tag := range tags {
     return nil
 }
 
-func (this TagsCommand) listTagsRecursive(db *Database, paths []string) error {
+func (command TagsCommand) listTagsRecursive(db *Database, paths []string) error {
     for _, path := range paths {
         fileInfo, error := os.Lstat(path)
         if error != nil { return error }
 
         if fileInfo.Mode() & os.ModeType == 0 {
-            tags, error := this.tagsForPath(db, path)
+            tags, error := command.tagsForPath(db, path)
             if error != nil { return error }
             if tags == nil { continue }
 
                 childPaths[index] = filepath.Join(path, dirName)
             }
 
-            error = this.listTagsRecursive(db, childPaths)
+            error = command.listTagsRecursive(db, childPaths)
             if error != nil { return error }
         }
     }
     return nil
 }
 
-func (this TagsCommand) tagsForPath(db *Database, path string) ([]Tag, error) {
+func (TagsCommand) tagsForPath(db *Database, path string) ([]Tag, error) {
 	absPath, error := filepath.Abs(path)
 	if error != nil { return nil, error }
 

src/main/commands/unmount.go

 
 type UnmountCommand struct{}
 
-func (this UnmountCommand) Name() string {
+func (UnmountCommand) Name() string {
 	return "unmount"
 }
 
-func (this UnmountCommand) Summary() string {
+func (UnmountCommand) Summary() string {
 	return "unmounts the virtual file-system"
 }
 
-func (this UnmountCommand) Help() string {
+func (UnmountCommand) Help() string {
 	return `  tags unount MOUNTPOINT
 
 Unmounts a previously mounted virtual file-system at the mountpoint specified.`
 }
 
-func (this UnmountCommand) Exec(args []string) error {
+func (UnmountCommand) Exec(args []string) error {
 	if len(args) < 1 {
 		return errors.New("Path to unmount not speciified.")
 	}

src/main/commands/untag.go

 
 type UntagCommand struct{}
 
-func (this UntagCommand) Name() string {
+func (UntagCommand) Name() string {
 	return "untag"
 }
 
-func (this UntagCommand) Summary() string {
+func (UntagCommand) Summary() string {
 	return "removes all tags or specific tags from a file"
 }
 
-func (this UntagCommand) Help() string {
+func (UntagCommand) Help() string {
 	return `  tmsu untag FILE TAG...
   tmsu untag --all FILE...
 
   --all    strip each FILE of all tags`
 }
 
-func (this UntagCommand) Exec(args []string) error {
+func (command UntagCommand) Exec(args []string) error {
 	if len(args) < 1 {
 		return errors.New("No arguments specified.")
 	}
     if args[0] == "--all" {
         if len(args) < 2 { return errors.New("Files to untag must be specified.") }
 
-        error := this.removeFiles(args[1:])
+        error := command.removeFiles(args[1:])
         if error != nil { return error }
     } else {
         if len(args) < 2 { return errors.New("Tags to remove must be specified.") }
 
-        error := this.untagFile(args[0], args[1:])
+        error := command.untagFile(args[0], args[1:])
         if error != nil { return error }
     }
 
 	return nil
 }
 
-// implementation
-
-func (this UntagCommand) removeFiles(paths []string) error {
+func (UntagCommand) removeFiles(paths []string) error {
     db, error := OpenDatabase(databasePath())
     if error != nil {
         return error
     return nil
 }
 
-func (this UntagCommand) untagFile(path string, tagNames []string) error {
+func (command UntagCommand) untagFile(path string, tagNames []string) error {
 	absPath, error := filepath.Abs(path)
 	if error != nil { return error }
 
 	if file == nil { return errors.New("File '" + path + "' is not tagged.") }
 
     for _, tagName := range tagNames {
-        error = this.unapplyTag(db, path, file.Id, tagName)
+        error = command.unapplyTag(db, path, file.Id, tagName)
         if error != nil { return error }
     }
 
 	return nil
 }
 
-func (this UntagCommand) unapplyTag(db *Database, path string, fileId uint, tagName string) error {
+func (UntagCommand) unapplyTag(db *Database, path string, fileId uint, tagName string) error {
 	tag, error := db.TagByName(tagName)
 	if error != nil {
 		return error

src/main/commands/version.go

 
 type VersionCommand struct{}
 
-func (this VersionCommand) Name() string {
+func (VersionCommand) Name() string {
 	return "version"
 }
 
-func (this VersionCommand) Summary() string {
+func (VersionCommand) Summary() string {
 	return "displays version and copyright information"
 }
 
-func (this VersionCommand) Help() string {
+func (VersionCommand) Help() string {
 	return `  tmsu version
 
 Displays version and copyright information.`
 }
 
-func (this VersionCommand) Exec(args []string) error {
+func (VersionCommand) Exec(args []string) error {
 	fmt.Println("tmsu", version)
 	fmt.Println()
 	fmt.Println(`Copyright 2011 Paul Ruane.

src/main/database.go

 	return &database, nil
 }
 
-func (this *Database) Close() error {
-	return this.connection.Close()
+func (db *Database) Close() error {
+	return db.connection.Close()
 }
 
-func (this Database) TagCount() (uint, error) {
+func (db Database) TagCount() (uint, error) {
 	sql := `SELECT count(1)
 			FROM tag`
 
-	rows, error := this.connection.Query(sql)
+	rows, error := db.connection.Query(sql)
 	if error != nil { return 0, error }
 	defer rows.Close()
 
 	return count, nil
 }
 
-func (this Database) Tags() ([]Tag, error) {
+func (db Database) Tags() ([]Tag, error) {
 	sql := `SELECT id, name
             FROM tag
             ORDER BY name`
 
-	rows, error := this.connection.Query(sql)
+	rows, error := db.connection.Query(sql)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return tags, nil
 }
 
-func (this Database) TagByName(name string) (*Tag, error) {
+func (db Database) TagByName(name string) (*Tag, error) {
 	sql := `SELECT id
 	        FROM tag
 	        WHERE name = ?`
 
-	rows, error := this.connection.Query(sql, name)
+	rows, error := db.connection.Query(sql, name)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return &Tag{id, name}, nil
 }
 
-func (this Database) TagsByFileId(fileId uint) ([]Tag, error) {
+func (db Database) TagsByFileId(fileId uint) ([]Tag, error) {
 	sql := `SELECT id, name
             FROM tag
             WHERE id IN (
             )
             ORDER BY name`
 
-	rows, error := this.connection.Query(sql, fileId)
+	rows, error := db.connection.Query(sql, fileId)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return tags, nil
 }
 
-func (this Database) TagsForTags(tagNames []string) ([]Tag, error) {
+func (db Database) TagsForTags(tagNames []string) ([]Tag, error) {
 	sql := `SELECT id, name
             FROM tag
             WHERE id IN (
 		castTagNames[index] = tagName
 	}
 
-	rows, error := this.connection.Query(sql, castTagNames...)
+	rows, error := db.connection.Query(sql, castTagNames...)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 		error = rows.Scan(&tagId, &tagName)
 		if error != nil { return nil, error }
 
-		if !this.contains(tagNames, tagName) {
+		if !db.contains(tagNames, tagName) {
 			tags = append(tags, Tag{tagId, tagName})
 		}
 	}
 	return tags, nil
 }
 
-func (this Database) AddTag(name string) (*Tag, error) {
+func (db Database) AddTag(name string) (*Tag, error) {
 	sql := `INSERT INTO tag (name)
 	        VALUES (?)`
 
-	result, error := this.connection.Exec(sql, name)
+	result, error := db.connection.Exec(sql, name)
 	if error != nil { return nil, error }
 
 	id, error := result.LastInsertId()
 	return &Tag{uint(id), name}, nil
 }
 
-func (this Database) RenameTag(tagId uint, name string) (*Tag, error) {
+func (db Database) RenameTag(tagId uint, name string) (*Tag, error) {
 	sql := `UPDATE tag
 	        SET name = ?
 	        WHERE id = ?`
 
-	result, error := this.connection.Exec(sql, name, tagId)
+	result, error := db.connection.Exec(sql, name, tagId)
 	if error != nil { return nil, error }
 
 	rowsAffected, error := result.RowsAffected()
 	return &Tag{tagId, name}, nil
 }
 
-func (this Database) DeleteTag(tagId uint) error {
+func (db Database) DeleteTag(tagId uint) error {
 	sql := `DELETE FROM tag
 	        WHERE id = ?`
 
-	result, error := this.connection.Exec(sql, tagId)
+	result, error := db.connection.Exec(sql, tagId)
 	if error != nil { return error }
 
 	rowsAffected, error := result.RowsAffected()
 	return nil
 }
 
-func (this Database) FileCount() (uint, error) {
+func (db Database) FileCount() (uint, error) {
 	sql := `SELECT count(1)
 			FROM file`
 
-	rows, error := this.connection.Query(sql)
+	rows, error := db.connection.Query(sql)
 	if error != nil { return 0, error }
 	defer rows.Close()
 
 	return count, nil
 }
 
-func (this Database) Files() ([]File, error) {
+func (db Database) Files() ([]File, error) {
 	sql := `SELECT id, directory, name, fingerprint
 	        FROM file`
 
-	rows, error := this.connection.Query(sql)
+	rows, error := db.connection.Query(sql)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return files, nil
 }
 
-func (this Database) File(id uint) (*File, error) {
+func (db Database) File(id uint) (*File, error) {
 	sql := `SELECT directory, name, fingerprint
 	        FROM file
 	        WHERE id = ?`
 
-	rows, error := this.connection.Query(sql, id)
+	rows, error := db.connection.Query(sql, id)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return &File{id, directory, name, fingerprint}, nil
 }
 
-func (this Database) FileByPath(path string) (*File, error) {
+func (db Database) FileByPath(path string) (*File, error) {
     directory, name := filepath.Split(path)
     directory = filepath.Clean(directory)
 
 	        FROM file
 	        WHERE directory = ? AND name = ?`
 
-	rows, error := this.connection.Query(sql, directory, name)
+	rows, error := db.connection.Query(sql, directory, name)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return &File{id, directory, name, fingerprint}, nil
 }
 
-func (this Database) FilesByDirectory(directory string) ([]File, error) {
+func (db Database) FilesByDirectory(directory string) ([]File, error) {
 	sql := `SELECT id, directory, name, fingerprint
 	        FROM file
 	        WHERE directory = ? OR directory like ?`
 
-	rows, error := this.connection.Query(sql, directory, directory + "/%")
+	rows, error := db.connection.Query(sql, directory, directory + "/%")
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return files, nil
 }
 
-func (this Database) FilesByFingerprint(fingerprint string) ([]File, error) {
+func (db Database) FilesByFingerprint(fingerprint string) ([]File, error) {
 	sql := `SELECT id, directory, name
 	        FROM file
 	        WHERE fingerprint = ?`
 
-	rows, error := this.connection.Query(sql, fingerprint)
+	rows, error := db.connection.Query(sql, fingerprint)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return files, nil
 }
 
-func (this Database) DuplicateFiles() ([][]File, error) {
+func (db Database) DuplicateFiles() ([][]File, error) {
     sql := `SELECT id, directory, name, fingerprint
             FROM file
             WHERE fingerprint IN (SELECT fingerprint
                                 HAVING count(1) > 1)
             ORDER BY fingerprint`
 
-	rows, error := this.connection.Query(sql)
+	rows, error := db.connection.Query(sql)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return fileSets, nil
 }
 
-func (this Database) AddFile(path string, fingerprint string) (*File, error) {
+func (db Database) AddFile(path string, fingerprint string) (*File, error) {
     directory, name := filepath.Split(path)
     directory = filepath.Clean(directory) //TODO remove when patched
 
 	sql := `INSERT INTO file (directory, name, fingerprint)
 	        VALUES (?, ?, ?)`
 
-	result, error := this.connection.Exec(sql, directory, name, fingerprint)
+	result, error := db.connection.Exec(sql, directory, name, fingerprint)
 	if error != nil { return nil, error }
 
 	id, error := result.LastInsertId()
 	return &File{uint(id), directory, name, fingerprint}, nil
 }
 
-func (this Database) FilesWithTags(tagNames []string) ([]File, error) {
+func (db Database) FilesWithTags(tagNames []string) ([]File, error) {
 	sql := `SELECT id, directory, name, fingerprint
             FROM file
             WHERE id IN (
 		castTagNames[index] = tagName
 	}
 
-	rows, error := this.connection.Query(sql, castTagNames...)
+	rows, error := db.connection.Query(sql, castTagNames...)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return files, nil
 }
 
-func (this Database) UpdateFileFingerprint(fileId uint, fingerprint string) error {
+func (db Database) UpdateFileFingerprint(fileId uint, fingerprint string) error {
 	sql := `UPDATE file
 	        SET fingerprint = ?
 	        WHERE id = ?`
 
-	_, error := this.connection.Exec(sql, fingerprint, int(fileId))
+	_, error := db.connection.Exec(sql, fingerprint, int(fileId))
 	if error != nil { return error }
 
 	return nil
 }
 
-func (this Database) RemoveFile(fileId uint) error {
+func (db Database) RemoveFile(fileId uint) error {
 	sql := `DELETE FROM file
 	        WHERE id = ?`
 
-	result, error := this.connection.Exec(sql, fileId)
+	result, error := db.connection.Exec(sql, fileId)
 	if error != nil { return error }
 
 	rowsAffected, error := result.RowsAffected()
 	return nil
 }
 
-func (this Database) FileTagCount() (uint, error) {
+func (db Database) FileTagCount() (uint, error) {
 	sql := `SELECT count(1)
 			FROM file_tag`
 
-	rows, error := this.connection.Query(sql)
+	rows, error := db.connection.Query(sql)
 	if error != nil { return 0, error }
 	defer rows.Close()
 
 	return count, nil
 }
 
-func (this Database) FileTags() ([]FileTag, error) {
+func (db Database) FileTags() ([]FileTag, error) {
 	sql := `SELECT id, file_id, tag_id
 	        FROM file_tag`
 
-	rows, error := this.connection.Query(sql)
+	rows, error := db.connection.Query(sql)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return fileTags, nil
 }
 
-func (this Database) FileTagByFileIdAndTagId(fileId uint, tagId uint) (*FileTag, error) {
+func (db Database) FileTagByFileIdAndTagId(fileId uint, tagId uint) (*FileTag, error) {
 	sql := `SELECT id
 	        FROM file_tag
 	        WHERE file_id = ?
 	        AND tag_id = ?`
 
-	rows, error := this.connection.Query(sql, fileId, tagId)
+	rows, error := db.connection.Query(sql, fileId, tagId)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return &FileTag{fileTagId, fileId, tagId}, nil
 }
 
-func (this Database) FileTagsByTagId(tagId uint) ([]FileTag, error) {
+func (db Database) FileTagsByTagId(tagId uint) ([]FileTag, error) {
 	sql := `SELECT id, file_id
 	        FROM file_tag
 	        WHERE tag_id = ?`
 
-	rows, error := this.connection.Query(sql, tagId)
+	rows, error := db.connection.Query(sql, tagId)
 	if error != nil { return nil, error }
 	defer rows.Close()
 
 	return fileTags, nil
 }
 
-func (this Database) AnyFileTagsForFile(fileId uint) (bool, error) {
+func (db Database) AnyFileTagsForFile(fileId uint) (bool, error) {
     sql := `SELECT 1
             FROM file_tag
             WHERE file_id = ?
             LIMIT 1`
 
-	rows, error := this.connection.Query(sql, fileId)
+	rows, error := db.connection.Query(sql, fileId)
 	if error != nil { return false, error }
 	defer rows.Close()
 
     return false, nil
 }
 
-func (this Database) AddFileTag(fileId uint, tagId uint) (*FileTag, error) {
+func (db Database) AddFileTag(fileId uint, tagId uint) (*FileTag, error) {
 	sql := `INSERT INTO file_tag (file_id, tag_id)
 	        VALUES (?, ?)`
 
-	result, error := this.connection.Exec(sql, fileId, tagId)
+	result, error := db.connection.Exec(sql, fileId, tagId)
 	if error != nil { return nil, error }
 
 	id, error := result.LastInsertId()
 	return &FileTag{uint(id), fileId, tagId}, nil
 }
 
-func (this Database) RemoveFileTag(fileId uint, tagId uint) error {
+func (db Database) RemoveFileTag(fileId uint, tagId uint) error {
 	sql := `DELETE FROM file_tag
 	        WHERE file_id = ?
 	        AND tag_id = ?`
 
-	result, error := this.connection.Exec(sql, fileId, tagId)
+	result, error := db.connection.Exec(sql, fileId, tagId)
 	if error != nil { return error }
 
 	rowsAffected, error := result.RowsAffected()
 	return nil
 }
 
-func (this Database) RemoveFileTagsByFileId(fileId uint) error {
+func (db Database) RemoveFileTagsByFileId(fileId uint) error {
 	sql := `DELETE FROM file_tag
 	        WHERE file_id = ?`
 
-	_, error := this.connection.Exec(sql, fileId)
+	_, error := db.connection.Exec(sql, fileId)
 	if error != nil { return error }
 
 	return nil
 }
 
-func (this Database) RemoveFileTagsByTagId(tagId uint) error {
+func (db Database) RemoveFileTagsByTagId(tagId uint) error {
 	sql := `DELETE FROM file_tag
 	        WHERE tag_id = ?`
 
-	_, error := this.connection.Exec(sql, tagId)
+	_, error := db.connection.Exec(sql, tagId)
 	if error != nil { return error }
 
 	return nil
 }
 
-func (this Database) UpdateFileTags(oldTagId uint, newTagId uint) error {
+func (db Database) UpdateFileTags(oldTagId uint, newTagId uint) error {
 	sql := `UPDATE file_tag
 	        SET tag_id = ?
 	        WHERE tag_id = ?`
 
-	result, error := this.connection.Exec(sql, newTagId, oldTagId)
+	result, error := db.connection.Exec(sql, newTagId, oldTagId)
 	if error != nil { return error }
 
 	rowsAffected, error := result.RowsAffected()
 	return nil
 }
 
-func (this Database) CreateSchema() error {
+func (db Database) CreateSchema() error {
     sql := `CREATE TABLE IF NOT EXISTS tag (
                 id INTEGER PRIMARY KEY,
                 name TEXT NOT NULL
             )`
 
-	_, error := this.connection.Exec(sql)
+	_, error := db.connection.Exec(sql)
 	if error != nil { return error }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_tag_name
            ON tag(name)`
 
-	_, error = this.connection.Exec(sql)
+	_, error = db.connection.Exec(sql)
 	if error != nil { return error }
 
     sql = `CREATE TABLE IF NOT EXISTS file (
                CONSTRAINT con_file_path UNIQUE (directory, name)
            )`
 
-	_, error = this.connection.Exec(sql)
+	_, error = db.connection.Exec(sql)
 	if error != nil { return error }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_fingerprint
            ON file(fingerprint)`
 
-	_, error = this.connection.Exec(sql)
+	_, error = db.connection.Exec(sql)
 	if error != nil { return error }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_path
            ON file(directory, name)`
 
-	_, error = this.connection.Exec(sql)
+	_, error = db.connection.Exec(sql)
 	if error != nil { return error }
 
     sql = `CREATE TABLE IF NOT EXISTS file_tag (
                FOREIGN KEY (tag_id) REFERENCES tag(id)
            )`
 
-	_, error = this.connection.Exec(sql)
+	_, error = db.connection.Exec(sql)
 	if error != nil { return error }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_tag_file_id
            ON file_tag(file_id)`
 
-	_, error = this.connection.Exec(sql)
+	_, error = db.connection.Exec(sql)
 	if error != nil { return error }
 
     sql = `CREATE INDEX IF NOT EXISTS idx_file_tag_tag_id
            ON file_tag(tag_id)`
 
-	_, error = this.connection.Exec(sql)
+	_, error = db.connection.Exec(sql)
 	if error != nil { return error }
 
 	return nil
 }
 
-func (this Database) contains(list []string, str string) bool {
+func (db Database) contains(list []string, str string) bool {
 	for _, current := range list {
 		if current == str {
 			return true

src/main/entities/file.go

 	Fingerprint string
 }
 
-func (this File) Path() string {
-    return filepath.Join(this.Directory, this.Name)
+func (file File) Path() string {
+    return filepath.Join(file.Directory, file.Name)
 }

src/main/fusevfs.go

 	return &fuseVfs, nil
 }
 
-func (this FuseVfs) Unmount() {
-	this.state.Unmount()
+func (vfs FuseVfs) Unmount() {
+	vfs.state.Unmount()
 }
 
-func (this FuseVfs) Loop() {
-	this.state.Loop()
+func (vfs FuseVfs) Loop() {
+	vfs.state.Loop()
 }
 
-func (this FuseVfs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {
+func (vfs FuseVfs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {
 	switch name {
 	case "":
 		fallthrough
 		return &fuse.Attr{Mode: fuse.S_IFDIR | 0755}, fuse.OK
 	}
 
-	path := this.splitPath(name)
+	path := vfs.splitPath(name)
 	switch path[0] {
 	case "tags":
-		return this.getTaggedEntryAttr(path[1:])
+		return vfs.getTaggedEntryAttr(path[1:])
 	}
 
 	return nil, fuse.ENOENT
 }
 
-func (this FuseVfs) Unlink(name string, context *fuse.Context) fuse.Status {
-    fileId, error := this.parseFileId(name)
+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) }
 
     if fileId == 0 {
         return fuse.EPERM
     }
 
-    path := this.splitPath(name)
+    path := vfs.splitPath(name)
     tagNames := path[1:len(path) - 1]
 
     db, error := OpenDatabase(databasePath())
     return fuse.OK
 }
 
-func (this FuseVfs) OpenDir(name string, context *fuse.Context) (chan fuse.DirEntry, fuse.Status) {
+func (vfs FuseVfs) OpenDir(name string, context *fuse.Context) (chan fuse.DirEntry, fuse.Status) {
 	switch name {
-        case "": return this.topDirectories()
-        case "tags": return this.tagDirectories()
+        case "": return vfs.topDirectories()
+        case "tags": return vfs.tagDirectories()
 	}
 
-	path := this.splitPath(name)
+	path := vfs.splitPath(name)
 	switch path[0] {
-        case "tags": return this.openTaggedEntryDir(path[1:])
+        case "tags": return vfs.openTaggedEntryDir(path[1:])
 	}
 
 	return nil, fuse.ENOENT
 }
 
-func (this FuseVfs) Readlink(name string, context *fuse.Context) (string, fuse.Status) {
-	path := this.splitPath(name)
+func (vfs FuseVfs) Readlink(name string, context *fuse.Context) (string, fuse.Status) {
+	path := vfs.splitPath(name)
 	switch path[0] {
-        case "tags": return this.readTaggedEntryLink(path[1:])
+        case "tags": return vfs.readTaggedEntryLink(path[1:])
 	}
 
 	return "", fuse.ENOENT
 
 // implementation
 
-func (this FuseVfs) splitPath(path string) []string {
+func (vfs FuseVfs) splitPath(path string) []string {
 	return strings.Split(path, string(filepath.Separator))
 }
 
-func (this FuseVfs) parseFileId(name string) (uint, error) {
+func (vfs FuseVfs) parseFileId(name string) (uint, error) {
 	parts := strings.Split(name, ".")
 	count := len(parts)
 
 	return id, nil
 }
 
-func (this FuseVfs) topDirectories() (chan fuse.DirEntry, fuse.Status) {
+func (vfs FuseVfs) topDirectories() (chan fuse.DirEntry, fuse.Status) {
 	channel := make(chan fuse.DirEntry, 2)
 	channel <- fuse.DirEntry{Name: "tags", Mode: fuse.S_IFDIR}
 	close(channel)
 	return channel, fuse.OK
 }
 
-func (this FuseVfs) tagDirectories() (chan fuse.DirEntry, fuse.Status) {
-	db, error := OpenDatabase(this.databasePath)
+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) }
 	defer db.Close()
 
 	return channel, fuse.OK
 }
 
-func (this FuseVfs) getTaggedEntryAttr(path []string) (*fuse.Attr, fuse.Status) {
+func (vfs FuseVfs) getTaggedEntryAttr(path []string) (*fuse.Attr, fuse.Status) {
 	pathLength := len(path)
 	name := path[pathLength-1]
 
-	fileId, error := this.parseFileId(name)
+	fileId, error := vfs.parseFileId(name)
 	if error != nil { return nil, fuse.ENOENT }
 
 	if fileId == 0 {
 		return &fuse.Attr{Mode: fuse.S_IFDIR | 0755}, fuse.OK
 	}
 
-	db, error := OpenDatabase(this.databasePath)
+	db, error := OpenDatabase(vfs.databasePath)
 	if error != nil { log.Fatalf("Could not open database: %v", error) }
 	defer db.Close()
 
 	return &fuse.Attr{Mode: fuse.S_IFLNK | 0755, Size: uint64(size)}, fuse.OK
 }
 
-func (this FuseVfs) openTaggedEntryDir(path []string) (chan fuse.DirEntry, fuse.Status) {
-	db, error := OpenDatabase(this.databasePath)
+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) }
 	defer db.Close()
 
 	}
 
 	for _, file := range files {
-        linkName := this.getLinkName(file)
+        linkName := vfs.getLinkName(file)
 		channel <- fuse.DirEntry{Name: linkName, Mode: fuse.S_IFLNK}
 	}
 
 	return channel, fuse.OK
 }
 
-func (this FuseVfs) readTaggedEntryLink(path []string) (string, fuse.Status) {
+func (vfs FuseVfs) readTaggedEntryLink(path []string) (string, fuse.Status) {
 	name := path[len(path)-1]
 
-	db, error := OpenDatabase(this.databasePath)
+	db, error := OpenDatabase(vfs.databasePath)
 	if error != nil { log.Fatalf("Could not open database: %v", error) }
 	defer db.Close()
 
-	fileId, error := this.parseFileId(name)
+	fileId, error := vfs.parseFileId(name)
 	if error != nil { log.Fatalf("Could not parse file identifier: %v", error) }
 	if fileId == 0 { return "", fuse.ENOENT }
 
 	return file.Path(), fuse.OK
 }
 
-func (this FuseVfs) getLinkName(file File) string {
+func (vfs FuseVfs) getLinkName(file File) string {
     extension := filepath.Ext(file.Path())
     fileName := filepath.Base(file.Path())
     linkName := fileName[0 : len(fileName) - len(extension)]