Skip to content

Commit

Permalink
Ignore lint in samplers/probability/consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Aug 23, 2024
1 parent d848ea0 commit 8e8fe95
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion samplers/probability/consistent/base2.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ func splitProb(p float64) (uint8, uint8, float64) {
highP := expToFloat64(-high)
lowProb := (highP - p) / (highP - lowP)

return uint8(low), uint8(high), lowProb
return uint8(low), uint8(high), lowProb // nolint: gosec // 8-bit sample.
}
2 changes: 1 addition & 1 deletion samplers/probability/consistent/sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func ProbabilityBased(fraction float64, opts ...ProbabilityBasedOption) sdktrace
func (cs *consistentProbabilityBased) newR() uint8 {
cs.lock.Lock()
defer cs.lock.Unlock()
return uint8(bits.LeadingZeros64(uint64(cs.rnd.Int63())) - 1)
return uint8(bits.LeadingZeros64(uint64(cs.rnd.Int63())) - 1) // nolint: gosec // 8-bit sample.
}

func (cs *consistentProbabilityBased) lowChoice() bool {
Expand Down
2 changes: 1 addition & 1 deletion samplers/probability/consistent/tracestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func parseNumber(key string, input string, maximum uint8) (uint8, error) {
return maximum + 1, parseError(key, strconv.ErrRange)
}
// `value` is strictly less then the uint8 maximum. This cast is safe.
return uint8(value), nil
return uint8(value), nil // nolint: gosec

Check failure

Code scanning / CodeQL

Incorrect conversion between integer types High

Incorrect conversion of an unsigned 64-bit integer from
strconv.ParseUint
to a lower bit size type uint8 without an upper bound check.
}

func parseError(key string, err error) error {
Expand Down

0 comments on commit 8e8fe95

Please sign in to comment.