Skip to content

Commit

Permalink
[chore] Code linter findings for internal/aws (open-telemetry#24946)
Browse files Browse the repository at this point in the history
preallocate slices
do not assign a boolean if it is reassigned right after
  • Loading branch information
atoulme committed Aug 17, 2023
1 parent 58bcb0c commit fbed147
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions internal/aws/k8s/k8sclient/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ func InitSyncPollTimeout(pollTimeout time.Duration) Option {
}

func getStringifiedOptions(options ...Option) string {
var opts []string
for _, option := range options {
opts = append(opts, option.name)
opts := make([]string, len(options))
for i, option := range options {
opts[i] = option.name
}

sort.Strings(opts)
Expand Down
4 changes: 2 additions & 2 deletions internal/aws/metrics/metric_calculator.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (rm *MetricCalculator) Calculate(mKey Key, value interface{}, timestamp tim
cacheStore := rm.cache

var result interface{}
done := false
var done bool

rm.lock.Lock()
defer rm.lock.Unlock()
Expand Down Expand Up @@ -92,7 +92,7 @@ type Key struct {
}

func NewKey(metricMetadata interface{}, labels map[string]string) Key {
var kvs []attribute.KeyValue
kvs := make([]attribute.KeyValue, 0, len(labels))
var sortable attribute.Sortable
for k, v := range labels {
kvs = append(kvs, attribute.String(k, v))
Expand Down

0 comments on commit fbed147

Please sign in to comment.