diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index 9484b71c..abd6cf13 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -6,7 +6,7 @@ jobs: compatibility-test: strategy: matrix: - go: [ 1.15, 1.19 ] + go: [ 1.15, "1.20" ] os: [ X64, ARM64 ] runs-on: ${{ matrix.os }} steps: @@ -25,6 +25,22 @@ jobs: run: go test -v -race -covermode=atomic -coverprofile=coverage.out ./... - name: Benchmark run: go test -bench=. -benchmem -run=none ./... + windows-test: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: "1.20" + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: Build Test + run: go vet -v ./... style-test: runs-on: ubuntu-latest steps: diff --git a/net_io.go b/net_io.go index c7322fd2..f8270b18 100644 --- a/net_io.go +++ b/net_io.go @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build darwin || netbsd || freebsd || openbsd || dragonfly || linux +// +build darwin netbsd freebsd openbsd dragonfly linux + package netpoll import "syscall" diff --git a/poll_default.go b/poll_default.go index e9aaa093..e926311b 100644 --- a/poll_default.go +++ b/poll_default.go @@ -12,6 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +//go:build darwin || netbsd || freebsd || openbsd || dragonfly || linux +// +build darwin netbsd freebsd openbsd dragonfly linux + package netpoll func (p *defaultPoll) Alloc() (operator *FDOperator) { diff --git a/sys_exec.go b/sys_exec.go index cf3472e0..1c8e40e4 100644 --- a/sys_exec.go +++ b/sys_exec.go @@ -106,27 +106,18 @@ func iovecs(bs [][]byte, ivs []syscall.Iovec) (iovLen int) { continue } ivs[iovLen].Base = &chunk[0] - ivs[iovLen].SetLen(l) totalLen += l - iovLen++ - } - // iovecs limit length to 2GB(2^31) - if totalLen <= math.MaxInt32 { - return iovLen - } - // reset here - totalLen = math.MaxInt32 - for i := 0; i < iovLen; i++ { - l := int(ivs[i].Len) - if l < totalLen { - totalLen -= l - continue + if totalLen < math.MaxInt32 { + ivs[iovLen].SetLen(l) + iovLen++ + } else { + newLen := math.MaxInt32 - totalLen + l + ivs[iovLen].SetLen(newLen) + iovLen++ + return iovLen } - ivs[i].SetLen(totalLen) - iovLen = i + 1 - resetIovecs(nil, ivs[iovLen:]) - return iovLen } + return iovLen }