envoy-go-extension
envoy-go-extension copied to clipboard
Unused code gets `go vet` error
go vet ./...
# mosn.io/envoy-go-extension/pkg/utils
pkg/utils/string.go:12:22: possible misuse of unsafe.Pointer
pkg/utils/string.go:20:22: possible misuse of unsafe.Pointer
# mosn.io/envoy-go-extension/pkg/http
pkg/http/capi.go:36:79: possibly passing Go type with embedded pointer to C
I have checked all the errors, and it seems they come from unused file or argument, so we can simply remove them.
C.moeHttpSendLocalReply(r, C.int(response_code), unsafe.Pointer(&body_text), unsafe.Pointer(&strs), C.longlong(grpc_status), unsafe.Pointer(&details))
We can pass the addr of a flat buffer instead of []string
to avoid possibly passing Go type with embedded pointer to C
sHdr.Data = uintptr(unsafe.Pointer(uintptr(ptr)))
It seems we can simply write sHdr.Data = uintptr(ptr)
in this case? Do I miss something?