tests: enable all go vet checks

...and fix reported errors:

internal/fusefrontend_reverse/rfile.go:40: github.com/rfjakob/gocryptfs/internal/contentenc.FileHeader composite literal uses unkeyed fields
internal/fusefrontend_reverse/rfs.go:249: github.com/hanwen/go-fuse/fuse.DirEntry composite literal uses unkeyed fields
internal/fusefrontend_reverse/rfs.go:264: github.com/hanwen/go-fuse/fuse.DirEntry composite literal uses unkeyed fields
This commit is contained in:
Jakob Unterwurzacher 2016-09-25 19:01:50 +02:00
parent c7b3150afc
commit 166ba74a05
3 changed files with 14 additions and 4 deletions

View File

@ -34,10 +34,14 @@ func (rfs *reverseFS) NewFile(relPath string, flags uint32) (nodefs.File, fuse.S
return nil, fuse.ToStatus(err)
}
id := derivePathIV(relPath)
header := contentenc.FileHeader{
Version: contentenc.CurrentVersion,
Id: id,
}
return &reverseFile{
File: nodefs.NewDefaultFile(),
fd: fd,
header: contentenc.FileHeader{contentenc.CurrentVersion, id},
header: header,
contentEnc: rfs.contentEnc,
}, fuse.OK
}

View File

@ -246,7 +246,10 @@ func (rfs *reverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse.
// plus one for gocryptfs.diriv.
virtualFiles := make([]fuse.DirEntry, len(entries)+1)
// Virtual gocryptfs.diriv file
virtualFiles[0] = fuse.DirEntry{syscall.S_IFREG | 0400, nametransform.DirIVFilename}
virtualFiles[0] = fuse.DirEntry{
Mode: syscall.S_IFREG | 0400,
Name: nametransform.DirIVFilename,
}
// Actually used entries
nVirtual := 1
@ -261,7 +264,10 @@ func (rfs *reverseFS) OpenDir(cipherPath string, context *fuse.Context) ([]fuse.
cName = rfs.nameTransform.EncryptName(entries[i].Name, dirIV)
if len(cName) > syscall.NAME_MAX {
cName = nametransform.HashLongName(cName)
dotNameFile := fuse.DirEntry{syscall.S_IFREG | 0600, cName + nametransform.LongNameSuffix}
dotNameFile := fuse.DirEntry{
Mode: syscall.S_IFREG | 0600,
Name: cName + nametransform.LongNameSuffix,
}
virtualFiles[nVirtual] = dotNameFile
nVirtual++
}

View File

@ -13,4 +13,4 @@ go test ./... $*
# The tests cannot to this themselves as they are run in parallel
rm -Rf --one-file-system /tmp/gocryptfs-test-parent
go tool vet -shadow=true .
go tool vet -all -shadow .