Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code #229

Merged
merged 3 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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