Fix issues found by "go vet"

Issues were:

 # github.com/rfjakob/gocryptfs/contrib/findholes/holes
 contrib/findholes/holes/holes.go:136:2: unreachable code
 # github.com/rfjakob/gocryptfs/tests/root_test_test
 tests/root_test/root_test.go:139:2: unreachable code

Also make sure we actually run "go vet" against the whole
codebase.
This commit is contained in:
Jakob Unterwurzacher 2021-08-19 08:00:44 +02:00
parent c86981342b
commit 8ee595dd48
3 changed files with 3 additions and 4 deletions

View File

@ -121,7 +121,7 @@ func Find(fd int) (segments []Segment, err error) {
if err == syscall.ENXIO { if err == syscall.ENXIO {
segments = append(segments, segments = append(segments,
Segment{totalSize, SegmentEOF}) Segment{totalSize, SegmentEOF})
return segments, nil break
} }
if err != nil { if err != nil {
return nil, err return nil, err
@ -136,7 +136,7 @@ func Find(fd int) (segments []Segment, err error) {
return segments, nil return segments, nil
} }
// Verify the gives `segments` using a full bytewise file scan // Verify `segments` using a full bytewise file scan
func Verify(fd int, segments []Segment) (err error) { func Verify(fd int, segments []Segment) (err error) {
last := segments[len(segments)-1] last := segments[len(segments)-1]
if last.Type != SegmentEOF { if last.Type != SegmentEOF {

View File

@ -50,7 +50,7 @@ if ! go tool | grep vet > /dev/null ; then
elif [[ -d vendor ]] ; then elif [[ -d vendor ]] ; then
echo "vendor directory exists, skipping 'go tool vet'" echo "vendor directory exists, skipping 'go tool vet'"
else else
go vet "$@" . go vet "$@" ./...
fi fi
if command -v shellcheck > /dev/null ; then if command -v shellcheck > /dev/null ; then

View File

@ -136,7 +136,6 @@ func writeTillFull(t *testing.T, path string) (int, syscall.Errno) {
} }
sz += n sz += n
} }
return sz, 0
} }
// TestDiskFull needs root permissions because it creates a loop disk // TestDiskFull needs root permissions because it creates a loop disk