1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

enable vet.

This commit is contained in:
wdvxdr 2021-07-12 13:04:04 +08:00
parent 2d79fccd10
commit 061067bf95
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6
2 changed files with 11 additions and 5 deletions

View File

@ -25,6 +25,9 @@ jobs:
run: | run: |
go get -v -t -d ./... go get -v -t -d ./...
- name: Vet
run: go vet -stdmethods=false ./...
- name: Build - name: Build
run: go build -v ./... run: go build -v ./...

View File

@ -13,15 +13,18 @@ type multiReadSeeker struct {
multiReader io.Reader multiReader io.Reader
} }
func add(p unsafe.Pointer, x uintptr) unsafe.Pointer {
return unsafe.Pointer(uintptr(p) + x)
}
func IsChanClosed(ch interface{}) bool { func IsChanClosed(ch interface{}) bool {
if reflect.TypeOf(ch).Kind() != reflect.Chan { if reflect.TypeOf(ch).Kind() != reflect.Chan {
panic("object is not a channel.") panic("object is not a channel.")
} }
ptr := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ch)) + unsafe.Sizeof(uint(0)))) return *(*uint32)(
ptr += unsafe.Sizeof(uint(0)) * 2 add(*(*unsafe.Pointer)(add(unsafe.Pointer(&ch), unsafe.Sizeof(uintptr(0)))),
ptr += unsafe.Sizeof(uintptr(0)) unsafe.Sizeof(uint(0))*2+unsafe.Sizeof(uintptr(0))+unsafe.Sizeof(uint16(0))),
ptr += unsafe.Sizeof(uint16(0)) ) > 0
return *(*uint32)(unsafe.Pointer(ptr)) > 0
} }
func ComputeMd5AndLength(r io.Reader) ([]byte, int64) { func ComputeMd5AndLength(r io.Reader) ([]byte, int64) {