From c282d662ca78e4044bb7b2af44f37ed58bdcd9bc Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Wed, 13 Apr 2022 17:51:21 +0800 Subject: [PATCH] Fix: make golangci lint support multi GOOS --- Makefile | 6 +++++- component/process/process_windows.go | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index aed9ca4b4..36d7b3a27 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,11 @@ all-arch: $(PLATFORM_LIST) $(WINDOWS_ARCH_LIST) releases: $(gz_releases) $(zip_releases) lint: - golangci-lint run ./... + GOOS=darwin golangci-lint run ./... + GOOS=windows golangci-lint run ./... + GOOS=linux golangci-lint run ./... + GOOS=freebsd golangci-lint run ./... + GOOS=openbsd golangci-lint run ./... clean: rm $(BINDIR)/* diff --git a/component/process/process_windows.go b/component/process/process_windows.go index e2fb96cab..c51a36f6d 100644 --- a/component/process/process_windows.go +++ b/component/process/process_windows.go @@ -174,7 +174,7 @@ func newSearcher(isV4, isTCP bool) *searcher { func getTransportTable(fn uintptr, family int, class int) ([]byte, error) { for size, buf := uint32(8), make([]byte, 8); ; { ptr := unsafe.Pointer(&buf[0]) - err, _, _ := syscall.Syscall6(fn, 6, uintptr(ptr), uintptr(unsafe.Pointer(&size)), 0, uintptr(family), uintptr(class), 0) + err, _, _ := syscall.SyscallN(fn, 6, uintptr(ptr), uintptr(unsafe.Pointer(&size)), 0, uintptr(family), uintptr(class), 0) switch err { case 0: @@ -209,7 +209,7 @@ func getExecPathFromPID(pid uint32) (string, error) { buf := make([]uint16, syscall.MAX_LONG_PATH) size := uint32(len(buf)) - r1, _, err := syscall.Syscall6( + r1, _, err := syscall.SyscallN( queryProcName, 4, uintptr(h), uintptr(1),