Skip to content

Commit

Permalink
bump go v1.20 (also go-libp2p v0.25.1 and kubo v0.19.0-rc1)
Browse files Browse the repository at this point in the history
Needed bumps:
* ci: bump staticcheck 2023.1.2 (supports go v1.20)
* go get github.com/libp2p/go-libp2p@v0.25.1
* go get github.com/ipfs/kubo@v0.19.0-rc1
* go mod tidy

Import path changes:
* github.com/libp2p/go-libp2p-core -> github.com/libp2p/go-libp2p/core
* github.com/libp2p/go-libp2p-connmgr -> github.com/libp2p/go-libp2p/p2p/net/connmgr
* github.com/ipfs/go-ipfs-files -> github.com/ipfs/go-libipfs/files

Code changes:
* ipfs: config.NewOptionalInteger() and config.NewOptionalDuration()
* ipfsconnect/subpub: connmanager.WithGracePeriod(time.Second*10))
* ipfsconnect/subpub: c.Apply(libp2p.Defaults)
* ipfsconnect/subpub: disable TestSubPub until fixed
* util/net_test: fix go vet warning
* api/autoswag: fix gofmt issue
* all: rand.Seed() no longer needed in go v1.20
    according to https://tip.golang.org/doc/go1.20#math/rand
    The math/rand package now automatically seeds the global random number generator
    with a random value, and the top-level Seed function has been deprecated
* benchmark/vochain: fix 'this value of processID is never used'
* rpcclient/util: use crypto/rand.Int instead of deprecated math/rand.Intn
  • Loading branch information
altergui committed Mar 10, 2023
1 parent 477412d commit dcf2e8e
Show file tree
Hide file tree
Showing 23 changed files with 337 additions and 721 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go environment
uses: actions/setup-go@v3
with:
go-version: '1.19.5'
go-version: '1.20'
cache: true
- name: Tidy go cache
run: |
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
# staticcheck provides a github action, use it (https://staticcheck.io/docs/running-staticcheck/ci/github-actions/)
# or use golangci-lint (github action) with staticcheck as enabled linter
run: |
curl -L https://github.com/dominikh/go-tools/releases/download/v0.3.3/staticcheck_linux_amd64.tar.gz | tar -xzf -
curl -L https://github.com/dominikh/go-tools/releases/download/2023.1.2/staticcheck_linux_amd64.tar.gz | tar -xzf -
- name: Run staticcheck
run: |
./staticcheck/staticcheck ./... 2> staticcheck/stderr
Expand All @@ -78,7 +78,7 @@ jobs:
- name: Set up Go environment
uses: actions/setup-go@v3
with:
go-version: '1.19.5'
go-version: '1.20'
cache: true
- name: Tidy go cache
run: go mod tidy
Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
- name: Set up Go environment
uses: actions/setup-go@v3
with:
go-version: '1.19.5'
go-version: '1.20'
cache: true
- name: Tidy go cache
run: go mod tidy
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:experimental

FROM golang:1.19.5 AS builder
FROM golang:1.20 AS builder

ARG BUILDARGS

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For running vocdoni-node in gateway mode, 8 GiB of ram memory is recommended (4

#### Compile and run

Compile from source in a golang environment (Go>1.19 required):
Compile from source in a golang environment (Go>1.20 required):

```bash
git clone https://github.com/vocdoni/vocdoni-node.git
Expand Down
2 changes: 1 addition & 1 deletion api/autoswag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func UpdateRouterTags(fset *token.FileSet, parsedFile *ast.File, fmap map[string

for _, pm := range pms {
line := &ast.Comment{
Text: fmt.Sprintf(`// @Router %s [%s]`, pm.path, pm.method),
Text: fmt.Sprintf("//\t@Router %s [%s]", pm.path, pm.method),
Slash: token.Pos(int(x.Pos() - 1)),
}
list = append(list, line)
Expand Down
6 changes: 0 additions & 6 deletions benchmark/api_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package test
import (
"flag"
"fmt"
"math/rand"
"testing"
"time"

"go.vocdoni.io/dvote/crypto/ethereum"
"go.vocdoni.io/dvote/log"
Expand All @@ -17,10 +15,6 @@ import (
"go.vocdoni.io/dvote/test/testcommon"
)

// The init function and flags are shared with the other benchmark files.
// These globals can only be read, not modified.
func init() { rand.Seed(time.Now().UnixNano()) }

var (
hostFlag = flag.String("host", "", "alternative host to run against, e.g. ws[s]://<HOST>[:9090]/dvote)")
censusSize = flag.Int("censusSize", 100, "number of census entries to add (minimum 100)")
Expand Down
3 changes: 0 additions & 3 deletions benchmark/vochain_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
client "go.vocdoni.io/dvote/rpcclient"
api "go.vocdoni.io/dvote/rpctypes"
"go.vocdoni.io/dvote/test/testcommon"
"go.vocdoni.io/dvote/test/testcommon/testutil"
"go.vocdoni.io/dvote/types"
"go.vocdoni.io/dvote/util"
"go.vocdoni.io/dvote/vochain"
Expand Down Expand Up @@ -47,7 +46,6 @@ func BenchmarkVochainBatchProof(b *testing.B) {

// setup the basic parties
entityID := dvoteServer.Signer.Address().Bytes()
processID := testutil.Hex2byte(b, hexProcessID)

// create census and process
censusRoot, _, processID := createCensusAndProcess(b, cl, dvoteServer, keySet, entityID)
Expand Down Expand Up @@ -103,7 +101,6 @@ func BenchmarkVochainSingleProof(b *testing.B) {

// setup the basic parties
entityID := dvoteServer.Signer.Address().Bytes()
processID := testutil.Hex2byte(b, hexProcessID)

// create census and process
censusRoot, _, processID := createCensusAndProcess(b, cl, dvoteServer, keySet, entityID)
Expand Down
4 changes: 0 additions & 4 deletions benchmark/zk_census_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ import (
"encoding/json"
"fmt"
"math/big"
"math/rand"
"net/url"
"path"
"testing"
"time"

qt "github.com/frankban/quicktest"
"github.com/google/uuid"
Expand All @@ -29,8 +27,6 @@ import (
"go.vocdoni.io/dvote/vochain"
)

func init() { rand.Seed(time.Now().UnixNano()) }

var zkCircuitTest = circuit.CircuitsConfigurations["dev"]

// go test -v -run=- -bench=BenchmarkZkCensus -benchmem -count=100 .
Expand Down
3 changes: 0 additions & 3 deletions cmd/end2endtest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"math/big"
"math/rand"
"net/url"
"os"
"path/filepath"
Expand Down Expand Up @@ -122,8 +121,6 @@ func main() {
log.Init(c.logLevel, "stdout")
log.Infow("starting "+filepath.Base(os.Args[0]), "version", internal.Version)

rand.Seed(time.Now().UnixNano())

if len(c.accountPrivKeys) == 0 {
c.accountPrivKeys = []string{util.RandomHex(32)}
log.Infof("no keys passed, generated random private key: %s", c.accountPrivKeys)
Expand Down
3 changes: 0 additions & 3 deletions cmd/vochaintest/vochaintest.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"math/rand"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -112,8 +111,6 @@ func main() {
log.Init(*loglevel, "stdout")
log.Infow("starting "+filepath.Base(os.Args[0]), "version", internal.Version)

rand.Seed(time.Now().UnixNano())

accountKeys := make([]*ethereum.SignKeys, len(*accountPrivKeys))
for i, key := range *accountPrivKeys {
ak, err := privKeyToSigner(key)
Expand Down
4 changes: 2 additions & 2 deletions data/ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"time"

ipfscid "github.com/ipfs/go-cid"
files "github.com/ipfs/go-ipfs-files"
keystore "github.com/ipfs/go-ipfs-keystore"
files "github.com/ipfs/go-libipfs/files"
ipfslog "github.com/ipfs/go-log"
coreiface "github.com/ipfs/interface-go-ipfs-core"
"github.com/ipfs/interface-go-ipfs-core/options"
Expand All @@ -19,7 +19,7 @@ import (
"github.com/ipfs/kubo/core/corehttp"
"github.com/ipfs/kubo/core/corerepo"
"github.com/ipfs/kubo/repo/fsrepo"
ipfscrypto "github.com/libp2p/go-libp2p-core/crypto"
ipfscrypto "github.com/libp2p/go-libp2p/core/crypto"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr/net"
"github.com/multiformats/go-multicodec"
Expand Down
Loading

0 comments on commit dcf2e8e

Please sign in to comment.