1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-08 04:00:23 +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

@@ -10,8 +10,6 @@ const head = `// Code generated by codegen/getopenapiof. DO NOT EDIT.
package nano
import (
"unsafe"
"github.com/pkg/errors"
)
`
@@ -26,7 +24,7 @@ func (bot *Bot) getOpenAPIof[T any](ep string) (*[T any], error) {
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
}
`