mirror of
https://github.com/libp2p/go-reuseport.git
synced 2025-09-26 19:01:11 +08:00
sync: update CI config files (#94)
This commit is contained in:
8
.github/workflows/go-check.yml
vendored
8
.github/workflows/go-check.yml
vendored
@@ -11,12 +11,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
RUNGOGENERATE: false
|
RUNGOGENERATE: false
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "1.18.x"
|
go-version: "1.19.x"
|
||||||
- name: Run repo-specific setup
|
- name: Run repo-specific setup
|
||||||
uses: ./.github/actions/go-check-setup
|
uses: ./.github/actions/go-check-setup
|
||||||
if: hashFiles('./.github/actions/go-check-setup') != ''
|
if: hashFiles('./.github/actions/go-check-setup') != ''
|
||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
|
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
- name: Install staticcheck
|
- name: Install staticcheck
|
||||||
run: go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 # 2022.1 (v0.3.0)
|
run: go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3)
|
||||||
- name: Check that go.mod is tidy
|
- name: Check that go.mod is tidy
|
||||||
uses: protocol/multiple-go-modules@v1.2
|
uses: protocol/multiple-go-modules@v1.2
|
||||||
with:
|
with:
|
||||||
|
12
.github/workflows/go-test.yml
vendored
12
.github/workflows/go-test.yml
vendored
@@ -10,16 +10,16 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ "ubuntu", "windows", "macos" ]
|
os: [ "ubuntu", "windows", "macos" ]
|
||||||
go: [ "1.17.x", "1.18.x" ]
|
go: [ "1.18.x", "1.19.x" ]
|
||||||
env:
|
env:
|
||||||
COVERAGES: ""
|
COVERAGES: ""
|
||||||
runs-on: ${{ format('{0}-latest', matrix.os) }}
|
runs-on: ${{ format('{0}-latest', matrix.os) }}
|
||||||
name: ${{ matrix.os }} (go ${{ matrix.go }})
|
name: ${{ matrix.os }} (go ${{ matrix.go }})
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
- name: Go information
|
- name: Go information
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
# Use -coverpkg=./..., so that we include cross-package coverage.
|
# Use -coverpkg=./..., so that we include cross-package coverage.
|
||||||
# If package ./A imports ./B, and ./A's tests also cover ./B,
|
# If package ./A imports ./B, and ./A's tests also cover ./B,
|
||||||
# this means ./B's coverage will be significantly higher than 0%.
|
# this means ./B's coverage will be significantly higher than 0%.
|
||||||
run: go test -v -coverprofile=module-coverage.txt -coverpkg=./... ./...
|
run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./...
|
||||||
- name: Run tests (32 bit)
|
- name: Run tests (32 bit)
|
||||||
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
|
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
|
||||||
uses: protocol/multiple-go-modules@v1.2
|
uses: protocol/multiple-go-modules@v1.2
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
run: |
|
run: |
|
||||||
export "PATH=${{ env.PATH_386 }}:$PATH"
|
export "PATH=${{ env.PATH_386 }}:$PATH"
|
||||||
go test -v ./...
|
go test -v -shuffle=on ./...
|
||||||
- name: Run tests with race detector
|
- name: Run tests with race detector
|
||||||
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
|
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
|
||||||
uses: protocol/multiple-go-modules@v1.2
|
uses: protocol/multiple-go-modules@v1.2
|
||||||
@@ -62,7 +62,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
|
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
|
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
|
||||||
with:
|
with:
|
||||||
files: '${{ env.COVERAGES }}'
|
files: '${{ env.COVERAGES }}'
|
||||||
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
|
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
//go:build !plan9 && !windows && !wasm
|
//go:build !plan9 && !windows && !wasm
|
||||||
// +build !plan9,!windows,!wasm
|
|
||||||
|
|
||||||
package reuseport
|
package reuseport
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
//go:build wasm
|
//go:build wasm
|
||||||
// +build wasm
|
|
||||||
|
|
||||||
package reuseport
|
package reuseport
|
||||||
|
|
||||||
|
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
|||||||
module github.com/libp2p/go-reuseport
|
module github.com/libp2p/go-reuseport
|
||||||
|
|
||||||
go 1.17
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/stretchr/testify v1.7.0
|
github.com/stretchr/testify v1.7.0
|
||||||
|
14
interface.go
14
interface.go
@@ -4,14 +4,14 @@
|
|||||||
//
|
//
|
||||||
// For example:
|
// For example:
|
||||||
//
|
//
|
||||||
// // listen on the same port. oh yeah.
|
// // listen on the same port. oh yeah.
|
||||||
// l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
|
// l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
|
||||||
// l2, _ := reuse.Listen("tcp", "127.0.0.1:1234")
|
// l2, _ := reuse.Listen("tcp", "127.0.0.1:1234")
|
||||||
//
|
//
|
||||||
// // dial from the same port. oh yeah.
|
// // dial from the same port. oh yeah.
|
||||||
// l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
|
// l1, _ := reuse.Listen("tcp", "127.0.0.1:1234")
|
||||||
// l2, _ := reuse.Listen("tcp", "127.0.0.1:1235")
|
// l2, _ := reuse.Listen("tcp", "127.0.0.1:1235")
|
||||||
// c, _ := reuse.Dial("tcp", "127.0.0.1:1234", "127.0.0.1:1235")
|
// c, _ := reuse.Dial("tcp", "127.0.0.1:1234", "127.0.0.1:1235")
|
||||||
//
|
//
|
||||||
// Note: cant dial self because tcp/ip stacks use 4-tuples to identify connections,
|
// Note: cant dial self because tcp/ip stacks use 4-tuples to identify connections,
|
||||||
// and doing so would clash.
|
// and doing so would clash.
|
||||||
|
Reference in New Issue
Block a user