Skip to content

Commit

Permalink
sync: update CI config files (#1678)
Browse files Browse the repository at this point in the history
* bump go.mod to Go 1.18 and run go fix

* bump go.mod to Go 1.18 and run go fix

* bump go.mod to Go 1.18 and run go fix

* bump go.mod to Go 1.18 and run go fix

* run gofmt -s

* update .github/workflows/go-test.yml

* update .github/workflows/go-check.yml

* stop using the deprecated io/ioutil package

Co-authored-by: web3-bot <web3-bot@users.noreply.github.com>
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
  • Loading branch information
3 people authored Aug 17, 2022
1 parent 6b445e5 commit eff72c4
Show file tree
Hide file tree
Showing 59 changed files with 113 additions and 353 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
submodules: recursive
- uses: actions/setup-go@v2
with:
go-version: "1.18.x"
go-version: "1.19.x"
- name: Run repo-specific setup
uses: ./.github/actions/go-check-setup
if: hashFiles('./.github/actions/go-check-setup') != ''
Expand All @@ -27,7 +27,7 @@ jobs:
echo "RUNGOGENERATE=true" >> $GITHUB_ENV
fi
- 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
uses: protocol/multiple-go-modules@v1.2
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.17.x", "1.18.x" ]
go: [ "1.18.x", "1.19.x" ]
env:
COVERAGES: ""
runs-on: ${{ format('{0}-latest', matrix.os) }}
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
# Use -coverpkg=./..., so that we include cross-package coverage.
# If package ./A imports ./B, and ./A's tests also cover ./B,
# 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)
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
uses: protocol/multiple-go-modules@v1.2
Expand All @@ -52,7 +52,7 @@ jobs:
with:
run: |
export "PATH=${{ env.PATH_386 }}:$PATH"
go test -v ./...
go test -v -shuffle=on ./...
- name: Run tests with race detector
if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow
uses: protocol/multiple-go-modules@v1.2
Expand All @@ -62,7 +62,7 @@ jobs:
shell: bash
run: echo "COVERAGES=$(find . -type f -name 'module-coverage.txt' | tr -s '\n' ',' | sed 's/,$//')" >> $GITHUB_ENV
- name: Upload coverage to Codecov
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
with:
files: '${{ env.COVERAGES }}'
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
4 changes: 2 additions & 2 deletions examples/chat-with-mdns/mdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ type discoveryNotifee struct {
PeerChan chan peer.AddrInfo
}

//interface to be called when new peer is found
// interface to be called when new peer is found
func (n *discoveryNotifee) HandlePeerFound(pi peer.AddrInfo) {
n.PeerChan <- pi
}

//Initialize the MDNS service
// Initialize the MDNS service
func initMDNS(peerhost host.Host, rendezvous string) chan peer.AddrInfo {
// register with service so that we get notified about peer discovery
n := &discoveryNotifee{}
Expand Down
3 changes: 1 addition & 2 deletions examples/echo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
mrand "math/rand"

Expand Down Expand Up @@ -173,7 +172,7 @@ func runSender(ctx context.Context, ha host.Host, targetPeer string) {
return
}

out, err := ioutil.ReadAll(s)
out, err := io.ReadAll(s)
if err != nil {
log.Println(err)
return
Expand Down
2 changes: 1 addition & 1 deletion examples/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/libp2p/go-libp2p/examples

go 1.17
go 1.18

require (
github.com/gogo/protobuf v1.3.2
Expand Down
70 changes: 0 additions & 70 deletions examples/go.sum

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions examples/ipfs-camp-2019/05-Discovery/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package main

import (
"bufio"
"context"
"fmt"
"io"
"os"

"context"

"io/ioutil"

"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/protocol"
Expand All @@ -17,7 +15,7 @@ import (
const chatProtocol = protocol.ID("/libp2p/chat/1.0.0")

func chatHandler(s network.Stream) {
data, err := ioutil.ReadAll(s)
data, err := io.ReadAll(s)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
Expand All @@ -38,7 +36,7 @@ func chatSend(msg string, s network.Stream) error {
return err
}
s.Close()
data, err := ioutil.ReadAll(s)
data, err := io.ReadAll(s)
if err != nil {
return err
}
Expand Down
10 changes: 4 additions & 6 deletions examples/ipfs-camp-2019/06-Pubsub/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package main

import (
"bufio"
"context"
"fmt"
"io"
"os"

"context"

"io/ioutil"

"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/protocol"
Expand All @@ -19,7 +17,7 @@ const chatProtocol = protocol.ID("/libp2p/chat/1.0.0")
// TODO: Replace this handler with a function that handles message from a
// pubsub Subscribe channel.
func chatHandler(s network.Stream) {
data, err := ioutil.ReadAll(s)
data, err := io.ReadAll(s)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
Expand All @@ -42,7 +40,7 @@ func chatSend(msg string, s network.Stream) error {
return err
}
s.Close()
data, err := ioutil.ReadAll(s)
data, err := io.ReadAll(s)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion examples/ipfs-camp-2019/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/libp2p/go-libp2p/examples/ipfs-camp-2019

go 1.17
go 1.18

require (
github.com/gogo/protobuf v1.3.2
Expand Down
Loading

0 comments on commit eff72c4

Please sign in to comment.