graphdriver: temporarily ignore unsafeptr: possible misuse of reflect.SliceHeader

Probably needs a similar change as c208f03fbd,
but this code makes my head spin, so for now suppressing, and created a
tracking issue:

    daemon/graphdriver/graphtest/graphtest_unix.go:305:12: unsafeptr: possible misuse of reflect.SliceHeader (govet)
        header := *(*reflect.SliceHeader)(unsafe.Pointer(&buf))
                  ^
    daemon/graphdriver/graphtest/graphtest_unix.go:308:36: unsafeptr: possible misuse of reflect.SliceHeader (govet)
        data := *(*[]byte)(unsafe.Pointer(&header))
                                          ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e6dabfa977)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-05-31 13:08:46 +02:00
parent f2f387b131
commit ec3bfba89d
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -303,10 +303,10 @@ func writeRandomFile(path string, size uint64) error {
} }
// Cast to []byte // Cast to []byte
header := *(*reflect.SliceHeader)(unsafe.Pointer(&buf)) header := *(*reflect.SliceHeader)(unsafe.Pointer(&buf)) //nolint:govet // FIXME: unsafeptr: possible misuse of reflect.SliceHeader (govet) see https://github.com/moby/moby/issues/42444
header.Len *= 8 header.Len *= 8
header.Cap *= 8 header.Cap *= 8
data := *(*[]byte)(unsafe.Pointer(&header)) data := *(*[]byte)(unsafe.Pointer(&header)) //nolint:govet // FIXME: unsafeptr: possible misuse of reflect.SliceHeader (govet) see https://github.com/moby/moby/issues/42444
return ioutil.WriteFile(path, data, 0700) return ioutil.WriteFile(path, data, 0700)
} }