1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-09-16 09:26:25 +02:00

Fix lint issues in the label package (#1244)

Rename MergeItererator to MergeIterator to correct the spelling mistake.

Add comment for exported `EmptySet`.

Fix comments on the exported label `Type`s to conform to Go standards.
This commit is contained in:
Tyler Yahn
2020-10-12 08:39:12 -07:00
committed by GitHub
parent 7ecc55581b
commit bafde86b29
4 changed files with 31 additions and 15 deletions

View File

@@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Move the `go.opentelemetry.io/otel/api/trace/tracetest` package into `go.opentelemetry.io/otel/oteltest`. (#1229) - Move the `go.opentelemetry.io/otel/api/trace/tracetest` package into `go.opentelemetry.io/otel/oteltest`. (#1229)
- OTLP Exporter supports OTLP v0.5.0. (#1230) - OTLP Exporter supports OTLP v0.5.0. (#1230)
- The Sampler is now called on local child spans. (#1233) - The Sampler is now called on local child spans. (#1233)
- Rename `MergeItererator` to `MergeIterator` in the `go.opentelemetry.io/otel/label` package. (#1244)
## [0.13.0] - 2020-10-08 ## [0.13.0] - 2020-10-08

View File

@@ -24,7 +24,7 @@ type Iterator struct {
// MergeIterator supports iterating over two sets of labels while // MergeIterator supports iterating over two sets of labels while
// eliminating duplicate values from the combined set. The first // eliminating duplicate values from the combined set. The first
// iterator value takes precedence. // iterator value takes precedence.
type MergeItererator struct { type MergeIterator struct {
one oneIterator one oneIterator
two oneIterator two oneIterator
current KeyValue current KeyValue
@@ -84,8 +84,8 @@ func (i *Iterator) ToSlice() []KeyValue {
// NewMergeIterator returns a MergeIterator for merging two label sets // NewMergeIterator returns a MergeIterator for merging two label sets
// Duplicates are resolved by taking the value from the first set. // Duplicates are resolved by taking the value from the first set.
func NewMergeIterator(s1, s2 *Set) MergeItererator { func NewMergeIterator(s1, s2 *Set) MergeIterator {
mi := MergeItererator{ mi := MergeIterator{
one: makeOne(s1.Iter()), one: makeOne(s1.Iter()),
two: makeOne(s2.Iter()), two: makeOne(s2.Iter()),
} }
@@ -107,7 +107,7 @@ func (oi *oneIterator) advance() {
} }
// Next returns true if there is another label available. // Next returns true if there is another label available.
func (m *MergeItererator) Next() bool { func (m *MergeIterator) Next() bool {
if m.one.done && m.two.done { if m.one.done && m.two.done {
return false return false
} }
@@ -138,6 +138,6 @@ func (m *MergeItererator) Next() bool {
} }
// Label returns the current value after Next() returns true. // Label returns the current value after Next() returns true.
func (m *MergeItererator) Label() KeyValue { func (m *MergeIterator) Label() KeyValue {
return m.current return m.current
} }

View File

@@ -78,6 +78,9 @@ var (
const maxConcurrentEncoders = 3 const maxConcurrentEncoders = 3
// EmptySet returns a reference to a Set with no elements.
//
// This is a convenience provided for optimized calling utility.
func EmptySet() *Set { func EmptySet() *Set {
return emptySet return emptySet
} }

View File

@@ -40,16 +40,28 @@ type Value struct {
} }
const ( const (
INVALID Type = iota // No value. // INVALID is used for a Value with no value set.
BOOL // Boolean value, use AsBool() to get it. INVALID Type = iota
INT32 // 32 bit signed integral value, use AsInt32() to get it. // BOOL is a boolean Type Value.
INT64 // 64 bit signed integral value, use AsInt64() to get it. BOOL
UINT32 // 32 bit unsigned integral value, use AsUint32() to get it. // INT32 is a 32-bit signed integral Type Value.
UINT64 // 64 bit unsigned integral value, use AsUint64() to get it. INT32
FLOAT32 // 32 bit floating point value, use AsFloat32() to get it. // INT64 is a 64-bit signed integral Type Value.
FLOAT64 // 64 bit floating point value, use AsFloat64() to get it. INT64
STRING // String value, use AsString() to get it. // UINT32 is a 32-bit unsigned integral Type Value.
ARRAY // Array value of arbitrary type, use AsArray() to get it. UINT32
// UINT64 is a 64-bit unsigned integral Type Value.
UINT64
// FLOAT32 is a 32-bit floating point Type Value.
FLOAT32
// FLOAT64 is a 64-bit floating point Type Value.
FLOAT64
// STRING is a string Type Value.
STRING
// ARRAY is an array Type Value used to store 1-dimensional slices or
// arrays of bool, int, int32, int64, uint, uint32, uint64, float,
// float32, float64, or string types.
ARRAY
) )
// BoolValue creates a BOOL Value. // BoolValue creates a BOOL Value.