Skip to content

Commit b8d125d

Browse files
committed
Fixing golint in k8s.go
Signed-off-by: Raj Babu Das <[email protected]>
1 parent 2f0c0b8 commit b8d125d

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

pkg/provider/k8s/k8s.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ func (c *K8s) DeploymentsParse(*kingpin.ParseContext) error {
145145
// ResourceApply applies k8s objects.
146146
// The input is a slice of structs containing the filename and the slice of k8s objects present in the file.
147147
func (c *K8s) ResourceApply(deployments []Resource) error {
148-
var err error
149-
err = provider.CreateGrafanaDashboardsConfigMap()
148+
err := provider.CreateGrafanaDashboardsConfigMap()
150149
if err != nil {
151150
return fmt.Errorf("error applying grafana dashboards config err:%v", err)
152151
}
@@ -201,8 +200,7 @@ func (c *K8s) ResourceApply(deployments []Resource) error {
201200
// ResourceDelete deletes k8s objects.
202201
// The input is a slice of structs containing the filename and the slice of k8s objects present in the file.
203202
func (c *K8s) ResourceDelete(deployments []Resource) error {
204-
var err error
205-
err = provider.DeleteGrafanaDashboardsConfigMap()
203+
err := provider.DeleteGrafanaDashboardsConfigMap()
206204
if err != nil {
207205
return fmt.Errorf("error deleting grafana dashboards config err:%v", err)
208206
}

pkg/provider/provider.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ type DeploymentResource struct {
4545
FlagDeploymentVars map[string]string
4646
// Default DeploymentVars.
4747
DefaultDeploymentVars map[string]string
48-
// Dashboards
49-
Dashboards map[string]string
5048
}
5149

5250
// NewDeploymentResource returns DeploymentResource with default values.
@@ -171,11 +169,11 @@ func CreateGrafanaDashboardsConfigMap() error {
171169

172170
NodeMetrics, err := ioutil.ReadFile("manifests/dashboards/node-metrics.json")
173171
if err != nil {
174-
return nil
172+
return err
175173
}
176174
PromBench, err := ioutil.ReadFile("manifests/dashboards/prombench.json")
177175
if err != nil {
178-
return nil
176+
return err
179177
}
180178

181179
ConfigMapData := map[string]string{
@@ -196,7 +194,7 @@ func CreateGrafanaDashboardsConfigMap() error {
196194

197195
_, err = clientset.CoreV1().ConfigMaps("default").Create(context.TODO(), &newConfigMap, metav1.CreateOptions{})
198196
if err != nil {
199-
return nil
197+
return err
200198
}
201199

202200
log.Printf("resource created - kind: ConfigMap, name: grafana-dashboards")

0 commit comments

Comments
 (0)