Skip to content

Commit e8c0913

Browse files
authored
sync: update CI config files (#180)
1 parent 696f50a commit e8c0913

File tree

8 files changed

+46
-48
lines changed

8 files changed

+46
-48
lines changed

.github/workflows/go-check.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
env:
1212
RUNGOGENERATE: false
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
with:
1616
submodules: recursive
17-
- uses: actions/setup-go@v2
17+
- uses: actions/setup-go@v3
1818
with:
19-
go-version: "1.18.x"
19+
go-version: "1.19.x"
2020
- name: Run repo-specific setup
2121
uses: ./.github/actions/go-check-setup
2222
if: hashFiles('./.github/actions/go-check-setup') != ''
@@ -27,7 +27,7 @@ jobs:
2727
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
2828
fi
2929
- name: Install staticcheck
30-
run: go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 # 2022.1 (v0.3.0)
30+
run: go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3)
3131
- name: Check that go.mod is tidy
3232
uses: protocol/[email protected]
3333
with:

.github/workflows/go-test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
os: [ "ubuntu", "windows", "macos" ]
13-
go: [ "1.17.x", "1.18.x" ]
13+
go: [ "1.18.x", "1.19.x" ]
1414
env:
1515
COVERAGES: ""
1616
runs-on: ${{ format('{0}-latest', matrix.os) }}
1717
name: ${{ matrix.os }} (go ${{ matrix.go }})
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
with:
2121
submodules: recursive
22-
- uses: actions/setup-go@v2
22+
- uses: actions/setup-go@v3
2323
with:
2424
go-version: ${{ matrix.go }}
2525
- name: Go information
@@ -43,7 +43,7 @@ jobs:
4343
# Use -coverpkg=./..., so that we include cross-package coverage.
4444
# If package ./A imports ./B, and ./A's tests also cover ./B,
4545
# this means ./B's coverage will be significantly higher than 0%.
46-
run: go test -v -coverprofile=module-coverage.txt -coverpkg=./... ./...
46+
run: go test -v -shuffle=on -coverprofile=module-coverage.txt -coverpkg=./... ./...
4747
- name: Run tests (32 bit)
4848
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
4949
uses: protocol/[email protected]
@@ -52,7 +52,7 @@ jobs:
5252
with:
5353
run: |
5454
export "PATH=${{ env.PATH_386 }}:$PATH"
55-
go test -v ./...
55+
go test -v -shuffle=on ./...
5656
- name: Run tests with race detector
5757
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
5858
uses: protocol/[email protected]
@@ -62,7 +62,7 @@ jobs:
6262
shell: bash
6363
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
6464
- name: Upload coverage to Codecov
65-
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
65+
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
6666
with:
6767
files: '${{ env.COVERAGES }}'
6868
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}

doc.go

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,29 @@ Learn more at https://github.com/multiformats/multiaddr
77
88
Basic Use:
99
10-
import (
11-
"bytes"
12-
"strings"
13-
ma "github.com/multiformats/go-multiaddr"
14-
)
10+
import (
11+
"bytes"
12+
"strings"
13+
ma "github.com/multiformats/go-multiaddr"
14+
)
1515
16-
// construct from a string (err signals parse failure)
17-
m1, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234")
16+
// construct from a string (err signals parse failure)
17+
m1, err := ma.NewMultiaddr("/ip4/127.0.0.1/udp/1234")
1818
19-
// construct from bytes (err signals parse failure)
20-
m2, err := ma.NewMultiaddrBytes(m1.Bytes())
19+
// construct from bytes (err signals parse failure)
20+
m2, err := ma.NewMultiaddrBytes(m1.Bytes())
2121
22-
// true
23-
strings.Equal(m1.String(), "/ip4/127.0.0.1/udp/1234")
24-
strings.Equal(m1.String(), m2.String())
25-
bytes.Equal(m1.Bytes(), m2.Bytes())
26-
m1.Equal(m2)
27-
m2.Equal(m1)
28-
29-
// tunneling (en/decap)
30-
printer, _ := ma.NewMultiaddr("/ip4/192.168.0.13/tcp/80")
31-
proxy, _ := ma.NewMultiaddr("/ip4/10.20.30.40/tcp/443")
32-
printerOverProxy := proxy.Encapsulate(printer)
33-
proxyAgain := printerOverProxy.Decapsulate(printer)
22+
// true
23+
strings.Equal(m1.String(), "/ip4/127.0.0.1/udp/1234")
24+
strings.Equal(m1.String(), m2.String())
25+
bytes.Equal(m1.Bytes(), m2.Bytes())
26+
m1.Equal(m2)
27+
m2.Equal(m1)
3428
29+
// tunneling (en/decap)
30+
printer, _ := ma.NewMultiaddr("/ip4/192.168.0.13/tcp/80")
31+
proxy, _ := ma.NewMultiaddr("/ip4/10.20.30.40/tcp/443")
32+
printerOverProxy := proxy.Encapsulate(printer)
33+
proxyAgain := printerOverProxy.Decapsulate(printer)
3534
*/
3635
package multiaddr

filter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ func (fs *Filters) RemoveLiteral(ipnet net.IPNet) (removed bool) {
8585
// default is returned.
8686
//
8787
// TODO: currently, the last filter to match wins always, but it shouldn't be that way.
88-
// Instead, the highest-specific last filter should win; that way more specific filters
89-
// override more general ones.
88+
//
89+
// Instead, the highest-specific last filter should win; that way more specific filters
90+
// override more general ones.
9091
func (fs *Filters) AddrBlocked(a Multiaddr) (deny bool) {
9192
var (
9293
netip net.IP

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/multiformats/go-multiaddr
22

3-
go 1.17
3+
go 1.18
44

55
require (
66
github.com/ipfs/go-cid v0.0.7

interface.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ Learn more here: https://github.com/multiformats/multiaddr
1212
1313
Multiaddrs have both a binary and string representation.
1414
15-
import ma "github.com/multiformats/go-multiaddr"
16-
17-
addr, err := ma.NewMultiaddr("/ip4/1.2.3.4/tcp/80")
18-
// err non-nil when parsing failed.
15+
import ma "github.com/multiformats/go-multiaddr"
1916
17+
addr, err := ma.NewMultiaddr("/ip4/1.2.3.4/tcp/80")
18+
// err non-nil when parsing failed.
2019
*/
2120
type Multiaddr interface {
2221
json.Marshaler

net/net.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ func wrap(nconn net.Conn, laddr, raddr ma.Multiaddr) Conn {
8181
// This function does it's best to avoid "hiding" methods exposed by the wrapped
8282
// type. Guarantees:
8383
//
84-
// * If the wrapped connection exposes the "half-open" closer methods
85-
// (CloseWrite, CloseRead), these will be available on the wrapped connection
86-
// via type assertions.
87-
// * If the wrapped connection is a UnixConn, IPConn, TCPConn, or UDPConn, all
88-
// methods on these wrapped connections will be available via type assertions.
84+
// - If the wrapped connection exposes the "half-open" closer methods
85+
// (CloseWrite, CloseRead), these will be available on the wrapped connection
86+
// via type assertions.
87+
// - If the wrapped connection is a UnixConn, IPConn, TCPConn, or UDPConn, all
88+
// methods on these wrapped connections will be available via type assertions.
8989
func WrapNetConn(nconn net.Conn) (Conn, error) {
9090
if nconn == nil {
9191
return nil, fmt.Errorf("failed to convert nconn.LocalAddr: nil")
@@ -224,9 +224,9 @@ func (nla *netListenerAdapter) Accept() (net.Conn, error) {
224224

225225
// NetListener turns this Listener into a net.Listener.
226226
//
227-
// * Connections returned from Accept implement multiaddr/net Conn.
228-
// * Calling WrapNetListener on the net.Listener returned by this function will
229-
// return the original (underlying) multiaddr/net Listener.
227+
// - Connections returned from Accept implement multiaddr/net Conn.
228+
// - Calling WrapNetListener on the net.Listener returned by this function will
229+
// return the original (underlying) multiaddr/net Listener.
230230
func NetListener(l Listener) net.Listener {
231231
return &netListenerAdapter{l}
232232
}

net/net_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package manet
33
import (
44
"bytes"
55
"fmt"
6-
"io/ioutil"
76
"net"
87
"os"
98
"path/filepath"
@@ -80,7 +79,7 @@ func TestDial(t *testing.T) {
8079
}
8180

8281
func TestUnixSockets(t *testing.T) {
83-
dir, err := ioutil.TempDir(os.TempDir(), "manettest")
82+
dir, err := os.MkdirTemp(os.TempDir(), "manettest")
8483
if err != nil {
8584
t.Fatal(err)
8685
}

0 commit comments

Comments
 (0)