Skip to content
Open
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
7 changes: 4 additions & 3 deletions pkg/check/gsoc/gsoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/hex"
"fmt"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -227,16 +228,16 @@ func runInParallel(ctx context.Context, client *bee.Client, numChunks int, batch
}

func getTargetNeighborhood(address swarm.Address, depth int) (string, error) {
var targetNeighborhood string
var targetNeighborhood strings.Builder
for i := range depth {
hexChar := address.String()[i : i+1]
value, err := strconv.ParseUint(hexChar, 16, 4)
if err != nil {
return "", err
}
targetNeighborhood += fmt.Sprintf("%04b", value)
targetNeighborhood.WriteString(fmt.Sprintf("%04b", value))
}
return targetNeighborhood, nil
return targetNeighborhood.String(), nil
}

func mineResourceId(ctx context.Context, overlay swarm.Address, privKey *ecdsa.PrivateKey, depth int) ([]byte, swarm.Address, error) {
Expand Down
11 changes: 6 additions & 5 deletions pkg/check/kademlia/kademlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,17 @@ func checkKademliaD(topologies orchestration.ClusterTopologies, logger logging.L
}

if len(culprits) > 0 {
errmsg := ""
var errmsg strings.Builder
for node, c := range culprits {
msg := fmt.Sprintf("node %s expected connection to:\n", node)
var msg strings.Builder
msg.WriteString(fmt.Sprintf("node %s expected connection to:\n", node))
for _, addr := range c {
msg += addr.String() + "\n"
msg.WriteString(addr.String() + "\n")
}

errmsg += msg
errmsg.WriteString(msg.String())
}
return errors.New(errmsg)
return errors.New(errmsg.String())
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/bee.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (b BeeConfig) GetParentName() string {
// Export exports BeeConfig to orchestration.Config
func (b *BeeConfig) Export() (config orchestration.Config) {
localVal := reflect.ValueOf(b).Elem()
localType := reflect.TypeOf(b).Elem()
localType := reflect.TypeFor[BeeConfig]()
remoteVal := reflect.ValueOf(&config).Elem()

for i := range localVal.NumField() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type NodeEndpoint struct {
// Export exports Cluster to orchestration.ClusterOptions, skipping all other extra fields
func (c *Cluster) Export() (o orchestration.ClusterOptions) {
localVal := reflect.ValueOf(c).Elem()
localType := reflect.TypeOf(c).Elem()
localType := reflect.TypeFor[Cluster]()
remoteVal := reflect.ValueOf(&o).Elem()

for i := 0; i < localVal.NumField(); i++ {
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/funding.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Funding struct {
// Export exports Funding to orchestration.FundingOptions
func (f *Funding) Export() (o orchestration.FundingOptions) {
localVal := reflect.ValueOf(f).Elem()
localType := reflect.TypeOf(f).Elem()
localType := reflect.TypeFor[Funding]()
remoteVal := reflect.ValueOf(&o).Elem()

for i := 0; i < localVal.NumField(); i++ {
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/nodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (b NodeGroup) GetParentName() string {
// Export exports NodeGroup to orchestration.NodeGroupOptions
func (n *NodeGroup) Export() (o orchestration.NodeGroupOptions) {
localVal := reflect.ValueOf(n).Elem()
localType := reflect.TypeOf(n).Elem()
localType := reflect.TypeFor[NodeGroup]()
remoteVal := reflect.ValueOf(&o).Elem()

for i := 0; i < localVal.NumField(); i++ {
Expand Down
6 changes: 3 additions & 3 deletions pkg/random/random_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestPseudoGenerators(t *testing.T) {

func TestInt64_Type(t *testing.T) {
v := random.Int64()
vt := reflect.TypeOf(v).Kind()
vt := reflect.TypeFor[int64]().Kind()

if vt != reflect.Int64 {
t.Errorf("unexpected type, expected: %v, got: %v", reflect.Int64, vt)
Expand All @@ -124,7 +124,7 @@ func TestInt64_Type(t *testing.T) {
func TestCryptoSource_Uint64(t *testing.T) {
cs := random.CryptoSource{}
v := cs.Uint64()
vt := reflect.TypeOf(v).Kind()
vt := reflect.TypeFor[uint64]().Kind()

if vt != reflect.Uint64 {
t.Errorf("unexpected type, expected: %v, got: %v", reflect.Uint64, vt)
Expand All @@ -138,7 +138,7 @@ func TestCryptoSource_Uint64(t *testing.T) {
func TestCryptoSource_Int63(t *testing.T) {
cs := random.CryptoSource{}
v := cs.Int63()
vt := reflect.TypeOf(v).Kind()
vt := reflect.TypeFor[int64]().Kind()

if vt != reflect.Int64 {
t.Errorf("unexpected type, expected: %v, got: %v", reflect.Int64, vt)
Expand Down