resolve linter issues
This commit is contained in:
@@ -1,33 +0,0 @@
|
|||||||
issues:
|
|
||||||
exclude-rules:
|
|
||||||
- path: pkg/middleware/account_uuid.go
|
|
||||||
text: "SA4006:"
|
|
||||||
linters:
|
|
||||||
- staticcheck
|
|
||||||
- path: pkg/proxy/proxy_integration_test.go
|
|
||||||
linters:
|
|
||||||
- bodyclose
|
|
||||||
linters:
|
|
||||||
enable:
|
|
||||||
- bodyclose
|
|
||||||
- deadcode
|
|
||||||
- gosimple
|
|
||||||
- govet
|
|
||||||
- staticcheck
|
|
||||||
- structcheck
|
|
||||||
- typecheck
|
|
||||||
- unused
|
|
||||||
- varcheck
|
|
||||||
- depguard
|
|
||||||
- golint
|
|
||||||
- unconvert
|
|
||||||
# - scopelint
|
|
||||||
- maligned
|
|
||||||
- misspell
|
|
||||||
- prealloc
|
|
||||||
#- gosec
|
|
||||||
|
|
||||||
disable:
|
|
||||||
- errcheck
|
|
||||||
- ineffassign
|
|
||||||
- scopelint
|
|
||||||
@@ -49,21 +49,27 @@ func New() *Metrics {
|
|||||||
}, []string{"versions"}),
|
}, []string{"versions"}),
|
||||||
}
|
}
|
||||||
|
|
||||||
prometheus.Register(
|
mustNotFail(prometheus.Register(
|
||||||
m.Counter,
|
m.Counter,
|
||||||
)
|
))
|
||||||
|
|
||||||
prometheus.Register(
|
mustNotFail(prometheus.Register(
|
||||||
m.Latency,
|
m.Latency,
|
||||||
)
|
))
|
||||||
|
|
||||||
prometheus.Register(
|
mustNotFail(prometheus.Register(
|
||||||
m.Duration,
|
m.Duration,
|
||||||
)
|
))
|
||||||
|
|
||||||
prometheus.Register(
|
mustNotFail(prometheus.Register(
|
||||||
m.BuildInfo,
|
m.BuildInfo,
|
||||||
)
|
))
|
||||||
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mustNotFail(err error) {
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ func (m oidcAuth) getClaims(token string, req *http.Request) (claims oidc.Standa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var ok = false
|
var ok bool
|
||||||
if claims, ok = hit.V.(oidc.StandardClaims); !ok {
|
if claims, ok = hit.V.(oidc.StandardClaims); !ok {
|
||||||
status = http.StatusInternalServerError
|
status = http.StatusInternalServerError
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -136,16 +136,17 @@ func TestProxyIntegration(t *testing.T) {
|
|||||||
|
|
||||||
rr := httptest.NewRecorder()
|
rr := httptest.NewRecorder()
|
||||||
rp.ServeHTTP(rr, tc.input)
|
rp.ServeHTTP(rr, tc.input)
|
||||||
|
rsp := rr.Result()
|
||||||
|
|
||||||
if rr.Result().StatusCode != 200 {
|
if rsp.StatusCode != 200 {
|
||||||
t.Errorf("Expected status 200 from proxy-response got %v", rr.Result().StatusCode)
|
t.Errorf("Expected status 200 from proxy-response got %v", rsp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
resultBody, err := ioutil.ReadAll(rr.Result().Body)
|
resultBody, err := ioutil.ReadAll(rsp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Error reading result body")
|
t.Fatal("Error reading result body")
|
||||||
}
|
}
|
||||||
if err = rr.Result().Body.Close(); err != nil {
|
if err = rsp.Body.Close(); err != nil {
|
||||||
t.Fatal("Error closing result body")
|
t.Fatal("Error closing result body")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
|
|||||||
|
|
||||||
// TODO(tboerger): check if services are up and running
|
// TODO(tboerger): check if services are up and running
|
||||||
|
|
||||||
io.WriteString(w, http.StatusText(http.StatusOK))
|
if _, err := io.WriteString(w, http.StatusText(http.StatusOK)); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +47,8 @@ func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
|
|||||||
|
|
||||||
// TODO(tboerger): check if services are up and running
|
// TODO(tboerger): check if services are up and running
|
||||||
|
|
||||||
io.WriteString(w, http.StatusText(http.StatusOK))
|
if _, err := io.WriteString(w, http.StatusText(http.StatusOK)); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ func Server(opts ...Option) (svc.Service, error) {
|
|||||||
svc.Flags(options.Flags...),
|
svc.Flags(options.Flags...),
|
||||||
)
|
)
|
||||||
|
|
||||||
micro.RegisterHandler(service.Server(), chain)
|
if err := micro.RegisterHandler(service.Server(), chain); err != nil {
|
||||||
|
return svc.Service{}, err
|
||||||
|
}
|
||||||
|
|
||||||
service.Init()
|
service.Init()
|
||||||
return service, nil
|
return service, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user