mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-08 04:00:23 +08:00
reduce unsafe
This commit is contained in:
@@ -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
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user