Skip to content

Commit

Permalink
Fixing golint in k8s.go
Browse files Browse the repository at this point in the history
Signed-off-by: Raj Babu Das <[email protected]>
  • Loading branch information
imrajdas committed Aug 27, 2020
1 parent 2f0c0b8 commit b8d125d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions pkg/provider/k8s/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ func (c *K8s) DeploymentsParse(*kingpin.ParseContext) error {
// ResourceApply applies k8s objects.
// The input is a slice of structs containing the filename and the slice of k8s objects present in the file.
func (c *K8s) ResourceApply(deployments []Resource) error {
var err error
err = provider.CreateGrafanaDashboardsConfigMap()
err := provider.CreateGrafanaDashboardsConfigMap()
if err != nil {
return fmt.Errorf("error applying grafana dashboards config err:%v", err)
}
Expand Down Expand Up @@ -201,8 +200,7 @@ func (c *K8s) ResourceApply(deployments []Resource) error {
// ResourceDelete deletes k8s objects.
// The input is a slice of structs containing the filename and the slice of k8s objects present in the file.
func (c *K8s) ResourceDelete(deployments []Resource) error {
var err error
err = provider.DeleteGrafanaDashboardsConfigMap()
err := provider.DeleteGrafanaDashboardsConfigMap()
if err != nil {
return fmt.Errorf("error deleting grafana dashboards config err:%v", err)
}
Expand Down
8 changes: 3 additions & 5 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ type DeploymentResource struct {
FlagDeploymentVars map[string]string
// Default DeploymentVars.
DefaultDeploymentVars map[string]string
// Dashboards
Dashboards map[string]string
}

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

NodeMetrics, err := ioutil.ReadFile("manifests/dashboards/node-metrics.json")
if err != nil {
return nil
return err
}
PromBench, err := ioutil.ReadFile("manifests/dashboards/prombench.json")
if err != nil {
return nil
return err
}

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

_, err = clientset.CoreV1().ConfigMaps("default").Create(context.TODO(), &newConfigMap, metav1.CreateOptions{})
if err != nil {
return nil
return err
}

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

0 comments on commit b8d125d

Please sign in to comment.