1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-06 11:10:24 +08:00

reduce unsafe

This commit is contained in:
源文雨
2023-10-11 18:00:46 +09:00
parent 64f912e856
commit 58b8e7a98c
8 changed files with 19 additions and 29 deletions

View File

@@ -11,7 +11,6 @@ package nano
import (
"io"
"unsafe"
"github.com/pkg/errors"
)
@@ -27,7 +26,7 @@ func (bot *Bot) patchOpenAPIof[T any](ep string, body io.Reader) (*[T any], erro
if err != nil {
err = errors.Wrap(err, getCallerFuncName())
}
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), err
return &resp.[T any], err
}
`