Skip to content

Commit 22888a8

Browse files
committed
fix: clean up PR
1 parent 0de48a6 commit 22888a8

5 files changed

Lines changed: 22 additions & 27 deletions

File tree

pkg/check/socmatrix/socmatrix.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,6 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts any
163163
c.logger.Infof("socmatrix: scenarios 1-10 completed successfully across %d full nodes", len(fullNodeClients))
164164
}
165165

166-
// -------------------------------------------------------------------------
167-
// Precision scenarios 11-16 (former chunk-convergence) — same semantics.
168-
// Continue-on-error aggregation matches former chunk-convergence Run().
169-
// -------------------------------------------------------------------------
170166
n1, n2, err := pickClosestPair(ctx, fullNodeClients)
171167
if err != nil {
172168
return err

pkg/config/bee.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ type Inheritable interface {
1717
// inheritance (_inherit). Export returns just the embedded Config, so neither
1818
// _inherit nor any other config-loading detail can leak into the rendered file.
1919
type BeeConfig struct {
20-
Inherit `yaml:",inline"`
20+
*Inherit `yaml:",inline"`
2121
orchestration.Config `yaml:",inline"`
2222
}
2323

2424
func (b BeeConfig) GetParentName() string {
25-
return b.ParentName
25+
if b.Inherit != nil {
26+
return b.ParentName
27+
}
28+
return ""
2629
}
2730

2831
// Export returns the Bee flag configuration to be rendered into the node's

pkg/config/cluster.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// Cluster represents cluster configuration
1010
type Cluster struct {
1111
// parent to inherit settings from
12-
Inherit `yaml:",inline"`
12+
*Inherit `yaml:",inline"`
1313
// Cluster configuration
1414
Name *string `yaml:"name,omitempty"`
1515
Namespace *string `yaml:"namespace"`
@@ -24,7 +24,10 @@ type Cluster struct {
2424
}
2525

2626
func (b Cluster) GetParentName() string {
27-
return b.ParentName
27+
if b.Inherit != nil {
28+
return b.ParentName
29+
}
30+
return ""
2831
}
2932

3033
// ClusterNodeGroup represents node group in the cluster
@@ -59,7 +62,7 @@ func (c *Cluster) Export() (o orchestration.ClusterOptions) {
5962

6063
for i := 0; i < localVal.NumField(); i++ {
6164
localField := localVal.Field(i)
62-
if localField.IsValid() && canIsNil(localField) && !localField.IsNil() {
65+
if localField.IsValid() && !localField.IsNil() {
6366
localFieldVal := localVal.Field(i).Elem()
6467
localFieldName := localType.Field(i).Name
6568

pkg/config/config.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,13 @@ func mergeConfigs[T any](configs map[string]T) (map[string]T, error) {
104104
// applied per flag instead of all-or-nothing.
105105
if mf.Kind() == reflect.Struct {
106106
for j := 0; j < mf.NumField(); j++ {
107-
fj, pfj := mf.Field(j), pf.Field(j)
108-
if canIsNil(fj) && fj.IsNil() && canIsNil(pfj) && !pfj.IsNil() {
109-
fj.Set(pfj)
107+
if mf.Field(j).IsNil() && !pf.Field(j).IsNil() {
108+
mf.Field(j).Set(pf.Field(j))
110109
}
111110
}
112111
continue
113112
}
114-
if canIsNil(mf) && mf.IsNil() && canIsNil(pf) && !pf.IsNil() {
113+
if mf.IsNil() && !pf.IsNil() {
115114
mf.Set(pf)
116115
}
117116
}
@@ -122,24 +121,15 @@ func mergeConfigs[T any](configs map[string]T) (map[string]T, error) {
122121
return v, nil
123122
}
124123

125-
for k := range configs {
126-
if _, err := mergeParent(k); err != nil {
124+
for name := range configs {
125+
if _, err := mergeParent(name); err != nil {
127126
return nil, err
128127
}
129128
}
130129

131130
return mergedConfigs, nil
132131
}
133132

134-
func canIsNil(v reflect.Value) bool {
135-
switch v.Kind() {
136-
case reflect.Chan, reflect.Func, reflect.Map, reflect.Pointer, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
137-
return true
138-
default:
139-
return false
140-
}
141-
}
142-
143133
// Read reads given YAML files and unmarshals them into Config
144134
func Read(log logging.Logger, yamlFiles []YamlFile) (*Config, error) {
145135
c := Config{

pkg/config/nodegroup.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// NodeGroup represents node group configuration
1010
type NodeGroup struct {
1111
// parent to inherit settings from
12-
Inherit `yaml:",inline"`
12+
*Inherit `yaml:",inline"`
1313
// node group configuration
1414
Annotations *map[string]string `yaml:"annotations"`
1515
Image *string `yaml:"image"`
@@ -33,7 +33,10 @@ type NodeGroup struct {
3333
}
3434

3535
func (b NodeGroup) GetParentName() string {
36-
return b.ParentName
36+
if b.Inherit != nil {
37+
return b.ParentName
38+
}
39+
return ""
3740
}
3841

3942
// Export exports NodeGroup to orchestration.NodeGroupOptions
@@ -44,7 +47,7 @@ func (n *NodeGroup) Export() (o orchestration.NodeGroupOptions) {
4447

4548
for i := 0; i < localVal.NumField(); i++ {
4649
localField := localVal.Field(i)
47-
if localField.IsValid() && canIsNil(localField) && !localField.IsNil() {
50+
if localField.IsValid() && !localField.IsNil() {
4851
localFieldVal := localVal.Field(i).Elem()
4952
localFieldName := localType.Field(i).Name
5053

0 commit comments

Comments
 (0)