Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update minimum golang version to v1.21.7 #2710

Merged
merged 6 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-linux-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "*"

env:
go_version: '~1.20.12'
go_version: '~1.21.7'

jobs:
build-x86_64-binaries-tarball:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-macos-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- run: go version

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-public-ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- run: go version

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu-amd64-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "*"

env:
go_version: '~1.20.12'
go_version: '~1.21.7'

jobs:
build-jammy-amd64-package:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu-arm64-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- "*"

env:
go_version: '~1.20.12'
go_version: '~1.21.7'

jobs:
build-jammy-arm64-package:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-win-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true

- run: go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:
cancel-in-progress: true

env:
go_version: '~1.20.12'
go_version: '~1.21.7'
tmpnet_data_path: ~/.tmpnet/networks/1000

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- name: Run fuzz tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz_merkledb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.20.12'
go-version: '~1.21.7'
check-latest: true
- name: Run merkledb fuzz tests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

To start developing on AvalancheGo, you'll need a few things installed.

- Golang version >= 1.20.12
- Golang version >= 1.21.7
- gcc
- g++

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# README.md
# go.mod
# ============= Compilation Stage ================
FROM golang:1.20.12-bullseye AS builder
FROM golang:1.21.7-bullseye AS builder

WORKDIR /build
# Copy and download avalanche dependencies using go mod
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The minimum recommended hardware specification for nodes connected to Mainnet is

If you plan to build AvalancheGo from source, you will also need the following software:

- [Go](https://golang.org/doc/install) version >= 1.20.12
- [Go](https://golang.org/doc/install) version >= 1.21.7
- [gcc](https://gcc.gnu.org/)
- g++

Expand Down
7 changes: 3 additions & 4 deletions api/health/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ import (
"context"
"errors"
"fmt"
"maps"
"slices"
"sync"
"time"

"github.com/prometheus/client_golang/prometheus"

"go.uber.org/zap"

"golang.org/x/exp/maps"
"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
Expand Down Expand Up @@ -167,7 +166,7 @@ func (w *worker) Results(tags ...string) (map[string]Result, bool) {

func (w *worker) Start(ctx context.Context, freq time.Duration) {
w.startOnce.Do(func() {
detachedCtx := utils.Detach(ctx)
detachedCtx := context.WithoutCancel(ctx)
w.wg.Add(1)
go func() {
ticker := time.NewTicker(freq)
Expand Down
7 changes: 3 additions & 4 deletions api/metrics/multi_gatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
package metrics

import (
"cmp"
"errors"
"fmt"
"slices"
"sync"

"github.com/prometheus/client_golang/prometheus"

dto "github.com/prometheus/client_model/go"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/metric"
)

Expand Down Expand Up @@ -91,6 +90,6 @@ func (g *multiGatherer) Register(namespace string, gatherer prometheus.Gatherer)

func sortMetrics(m []*dto.MetricFamily) {
slices.SortFunc(m, func(i, j *dto.MetricFamily) int {
return utils.Compare(*i.Name, *j.Name)
return cmp.Compare(*i.Name, *j.Name)
})
}
3 changes: 1 addition & 2 deletions chains/atomic/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import (
"bytes"
"errors"
"fmt"

"golang.org/x/exp/slices"
"slices"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/database/linkeddb"
Expand Down
3 changes: 1 addition & 2 deletions codec/reflectcodec/type_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import (
"fmt"
"math"
"reflect"
"slices"
"time"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/codec"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/utils/wrappers"
Expand Down
2 changes: 1 addition & 1 deletion database/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

package database

import "golang.org/x/exp/slices"
import "slices"

// Batch is a write-only database that commits changes to its host database
// when Write is called. A batch cannot be used concurrently.
Expand Down
3 changes: 1 addition & 2 deletions database/encdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (
"context"
"crypto/cipher"
"crypto/rand"
"slices"
"sync"

"golang.org/x/crypto/chacha20poly1305"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/utils/hashing"
)
Expand Down
3 changes: 1 addition & 2 deletions database/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ package database

import (
"math/rand"
"slices"
"testing"
"time"

"github.com/stretchr/testify/require"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/utils"
)

Expand Down
3 changes: 1 addition & 2 deletions database/leveldb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"math"
"slices"
"sync"
"time"

Expand All @@ -23,8 +24,6 @@ import (

"go.uber.org/zap"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/utils"
"github.com/ava-labs/avalanchego/utils/logging"
Expand Down
6 changes: 2 additions & 4 deletions database/linkeddb/linkeddb.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
package linkeddb

import (
"slices"
"sync"

"golang.org/x/exp/maps"
"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/cache"
"github.com/ava-labs/avalanchego/database"
)
Expand Down Expand Up @@ -339,7 +337,7 @@ func (ldb *linkedDB) deleteNode(key []byte) error {

func (ldb *linkedDB) resetBatch() {
ldb.headKeyIsUpdated = false
maps.Clear(ldb.updatedNodes)
clear(ldb.updatedNodes)
ldb.batch.Reset()
}

Expand Down
3 changes: 1 addition & 2 deletions database/memdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ package memdb

import (
"context"
"slices"
"strings"
"sync"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/database"
)

Expand Down
3 changes: 1 addition & 2 deletions database/pebble/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import (
"context"
"encoding/json"
"errors"
"slices"
"sync"

"github.com/cockroachdb/pebble"

"github.com/prometheus/client_golang/prometheus"

"golang.org/x/exp/slices"

"go.uber.org/zap"

"github.com/ava-labs/avalanchego/database"
Expand Down
3 changes: 1 addition & 2 deletions database/pebble/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ package pebble
import (
"errors"
"fmt"
"slices"
"sync"

"github.com/cockroachdb/pebble"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/database"
)

Expand Down
3 changes: 1 addition & 2 deletions database/prefixdb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package prefixdb

import (
"context"
"slices"
"sync"

"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/utils/hashing"
)
Expand Down
2 changes: 1 addition & 1 deletion database/test_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"io"
"math"
"math/rand"
"slices"
"testing"

"github.com/stretchr/testify/require"

"go.uber.org/mock/gomock"

"golang.org/x/exp/maps"
"golang.org/x/exp/slices"

"golang.org/x/sync/errgroup"

Expand Down
6 changes: 2 additions & 4 deletions database/versiondb/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ package versiondb

import (
"context"
"slices"
"strings"
"sync"

"golang.org/x/exp/maps"
"golang.org/x/exp/slices"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/database/memdb"
)
Expand Down Expand Up @@ -210,7 +208,7 @@ func (db *Database) Abort() {
}

func (db *Database) abort() {
maps.Clear(db.mem)
clear(db.mem)
}

// CommitBatch returns a batch that contains all uncommitted puts/deletes.
Expand Down
3 changes: 1 addition & 2 deletions genesis/bootstrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/ips"
"github.com/ava-labs/avalanchego/utils/math"
"github.com/ava-labs/avalanchego/utils/sampler"
)

Expand Down Expand Up @@ -45,7 +44,7 @@ func GetBootstrappers(networkID uint32) []Bootstrapper {
// SampleBootstrappers returns the some beacons this node should connect to
func SampleBootstrappers(networkID uint32, count int) []Bootstrapper {
bootstrappers := GetBootstrappers(networkID)
count = math.Min(count, len(bootstrappers))
count = min(count, len(bootstrappers))

s := sampler.NewUniform()
s.Initialize(uint64(len(bootstrappers)))
Expand Down
3 changes: 2 additions & 1 deletion genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package genesis

import (
"cmp"
"encoding/base64"
"encoding/hex"
"encoding/json"
Expand Down Expand Up @@ -54,7 +55,7 @@ func (a Allocation) Unparse(networkID uint32) (UnparsedAllocation, error) {
}

func (a Allocation) Compare(other Allocation) int {
if amountCmp := utils.Compare(a.InitialAmount, other.InitialAmount); amountCmp != 0 {
if amountCmp := cmp.Compare(a.InitialAmount, other.InitialAmount); amountCmp != 0 {
return amountCmp
}
return a.AVAXAddr.Compare(other.AVAXAddr)
Expand Down
Loading
Loading