Skip to content

Commit

Permalink
Format code (#229)
Browse files Browse the repository at this point in the history
* Format code

* Fix gosec issue

* Fix gosec issue
  • Loading branch information
mhmxs authored Feb 27, 2023
1 parent 3f83bdd commit 83a8c6e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion pkg/metrics/prometheus_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ func servePrometheusExporter(metricsAddress string) error {
exporter, err := prometheus.InstallNewPipeline(prometheus.Config{
DefaultHistogramBoundaries: []float64{
0.1, 0.2, 0.3, 0.4, 0.5, 1, 1.5, 2, 2.5, 3.0, 5.0, 10.0, 15.0, 30.0,
}},
},
},
)
if err != nil {
return fmt.Errorf("failed to register prometheus exporter: %w", err)
Expand Down
4 changes: 1 addition & 3 deletions pkg/metrics/stats_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ const (
GrpcOperationTypeValue = "grpc"
)

var (
kmsRequest metric.Float64ValueRecorder
)
var kmsRequest metric.Float64ValueRecorder

type reporter struct {
meter metric.Meter
Expand Down
4 changes: 1 addition & 3 deletions providers/debug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import (

const logEncoder = "console"

var (
listenAddr = flag.String("listen-addr", "unix:///opt/trousseau-kms/debug/debug.socket", "gRPC listen address")
)
var listenAddr = flag.String("listen-addr", "unix:///opt/trousseau-kms/debug/debug.socket", "gRPC listen address")

func main() {
flag.Parse()
Expand Down
10 changes: 7 additions & 3 deletions providers/vault/pkg/vault/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package vault

import (
"encoding/base64"
"errors"
"fmt"
"net/http"
"path"
"reflect"
"sync"

"errors"

vaultapi "github.com/hashicorp/vault/api"
"github.com/ondat/trousseau/pkg/logger"
"github.com/ondat/trousseau/pkg/providers"
Expand Down Expand Up @@ -237,7 +236,12 @@ func (c *vaultWrapper) request(requestPath string, data interface{}) (*vaultapi.
} else if resp == nil {
return nil, fmt.Errorf("no response received for POST request on %s: %w", requestPath, err)
}
defer resp.Body.Close()

defer func() {
if err := resp.Body.Close(); err != nil {
klog.ErrorS(err, "Failed to close body")
}
}()

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected response code: %v received for POST request to %v", resp.StatusCode, requestPath)
Expand Down
3 changes: 1 addition & 2 deletions trousseau/pkg/health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package health

import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"

"errors"

"github.com/ondat/trousseau/pkg/logger"
"github.com/ondat/trousseau/pkg/providers"
"github.com/ondat/trousseau/pkg/utils"
Expand Down

0 comments on commit 83a8c6e

Please sign in to comment.