Skip to content

Commit

Permalink
Remove unnecessary nil checks
Browse files Browse the repository at this point in the history
making yet another linter happier

Signed-off-by: Matthias Rampke <[email protected]>
  • Loading branch information
matthiasr committed Sep 15, 2024
1 parent c818915 commit c7a3f16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/mapper/fsm/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (f *FSM) DumpFSM(w io.Writer) {
if idx == 0 {
// color for metric types
w.Write([]byte(fmt.Sprintf("%d [color=\"#D6B656\",fillcolor=\"#FFF2CC\"];\n", len(states)-1)))
} else if transition.transitions == nil || len(transition.transitions) == 0 {
} else if len(transition.transitions) == 0 {
// color for end state
w.Write([]byte(fmt.Sprintf("%d [color=\"#82B366\",fillcolor=\"#D5E8D4\"];\n", len(states)-1)))
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error {
if currentMapping.HistogramOptions == nil {
currentMapping.HistogramOptions = &HistogramOptions{}
}
if currentMapping.LegacyBuckets != nil && len(currentMapping.LegacyBuckets) != 0 {
if len(currentMapping.LegacyBuckets) != 0 {
currentMapping.HistogramOptions.Buckets = currentMapping.LegacyBuckets
}
if currentMapping.HistogramOptions.Buckets == nil || len(currentMapping.HistogramOptions.Buckets) == 0 {
if len(currentMapping.HistogramOptions.Buckets) == 0 {
currentMapping.HistogramOptions.Buckets = n.Defaults.HistogramOptions.Buckets
}
}
Expand All @@ -216,10 +216,10 @@ func (m *MetricMapper) InitFromYAMLString(fileContents string) error {
if currentMapping.SummaryOptions == nil {
currentMapping.SummaryOptions = &SummaryOptions{}
}
if currentMapping.LegacyQuantiles != nil && len(currentMapping.LegacyQuantiles) != 0 {
if len(currentMapping.LegacyQuantiles) != 0 {
currentMapping.SummaryOptions.Quantiles = currentMapping.LegacyQuantiles
}
if currentMapping.SummaryOptions.Quantiles == nil || len(currentMapping.SummaryOptions.Quantiles) == 0 {
if len(currentMapping.SummaryOptions.Quantiles) == 0 {
currentMapping.SummaryOptions.Quantiles = n.Defaults.SummaryOptions.Quantiles
}
if currentMapping.SummaryOptions.MaxAge == 0 {
Expand Down

0 comments on commit c7a3f16

Please sign in to comment.