Skip to content

Commit a604815

Browse files
committed
Fix a few linting errors
1 parent 5d05957 commit a604815

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

encoder/golang/encoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (encoder *Encoder) EncodeDashboard(dashboard sdk.Board) (string, error) {
4040

4141
buffer := &bytes.Buffer{}
4242
if err := file.Render(buffer); err != nil {
43-
return "", nil
43+
return "", err
4444
}
4545

4646
return buffer.String(), nil

encoder/golang/gauge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (encoder *Encoder) encodeGaugeSettings(panel sdk.Panel) []jen.Code {
5050
}
5151

5252
func (encoder *Encoder) encodeGaugeOrientation(panel sdk.Panel) jen.Code {
53-
orientationConst := "OrientationAuto"
53+
var orientationConst string
5454
switch panel.GaugePanel.Options.Orientation {
5555
case "":
5656
orientationConst = "OrientationAuto"

encoder/golang/paneltargets.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ func (encoder *Encoder) encodePrometheusTarget(target sdk.Target, grabanaPackage
9696
formatConstName = "FormatTimeSeries"
9797
default:
9898
encoder.logger.Warn("unhandled prometheus target format: using 'time_series' instead", zap.String("format", target.Format))
99-
10099
}
101100

102101
// only emit code if the default isn't used

encoder/golang/row.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ func (encoder *Encoder) encodeRow(row RowIR) *jen.Statement {
2424
rowSettings = append(rowSettings, rowQual("Collapse").Call())
2525
}
2626

27-
for _, panel := range row.Panels {
28-
rowSettings = append(rowSettings, panel)
29-
}
27+
rowSettings = append(rowSettings, row.Panels...)
3028

3129
return dashboardQual("Row").MultiLineCall(rowSettings...)
3230
}

encoder/golang/stat.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,12 @@ func (encoder *Encoder) encodeStatFieldConfigDefaults(defaults sdk.FieldConfigDe
150150
settings = append(settings, statQual("NoValue").Call(lit(defaults.NoValue)))
151151
}
152152

153+
// TODO: thresholds
153154
// RelativeThresholds/AbsoluteThresholds
154-
if defaults.Thresholds.Mode != "" && len(defaults.Thresholds.Steps) != 0 {
155-
// TODO: thresholds
156-
}
155+
/*
156+
if defaults.Thresholds.Mode != "" && len(defaults.Thresholds.Steps) != 0 {
157+
}
158+
*/
157159

158160
return settings
159161
}

encoder/golang/timeseries.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod
167167

168168
// Line interpolation mode
169169
if fieldConfig.Defaults.Custom.DrawStyle == "line" {
170-
lineInterpolationConst := "Linear"
170+
var lineInterpolationConst string
171171

172172
switch fieldConfig.Defaults.Custom.LineInterpolation {
173173
case "smooth":
@@ -193,7 +193,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod
193193
}
194194

195195
// Tooltip mode
196-
toolTipModeConst := "SingleSeries"
196+
var toolTipModeConst string
197197
switch panel.TimeseriesPanel.Options.Tooltip.Mode {
198198
case "none":
199199
toolTipModeConst = "NoSeries"
@@ -211,7 +211,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod
211211
}
212212

213213
// Gradient mode
214-
gradientModeConst := "Opacity"
214+
var gradientModeConst string
215215
switch fieldConfig.Defaults.Custom.GradientMode {
216216
case "none":
217217
gradientModeConst = "NoGradient"
@@ -231,7 +231,7 @@ func (encoder *Encoder) encodeTimeseriesVizualization(panel sdk.Panel) []jen.Cod
231231
}
232232

233233
// Stacking mode
234-
stackingModeConst := "Unstacked"
234+
var stackingModeConst string
235235
switch fieldConfig.Defaults.Custom.Stacking.Mode {
236236
case "none":
237237
stackingModeConst = "Unstacked"

0 commit comments

Comments
 (0)