golangci-lint v1.48 and fixes for "usestdlibvars" (#1711)
This commit is contained in:
parent
15a9e16530
commit
eea07b7a1a
|
@ -25,7 +25,7 @@ jobs:
|
||||||
uses: golangci/golangci-lint-action@v3
|
uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||||
version: v1.46
|
version: v1.48
|
||||||
# Optional: golangci-lint command line arguments.
|
# Optional: golangci-lint command line arguments.
|
||||||
args: --issues-exit-code=0 --timeout 10m
|
args: --issues-exit-code=0 --timeout 10m
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
|
|
2
.github/workflows/ci_golangci-lint.yml
vendored
2
.github/workflows/ci_golangci-lint.yml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
||||||
uses: golangci/golangci-lint-action@v3
|
uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
||||||
version: v1.46
|
version: v1.48
|
||||||
# Optional: golangci-lint command line arguments.
|
# Optional: golangci-lint command line arguments.
|
||||||
args: --issues-exit-code=1 --timeout 5m
|
args: --issues-exit-code=1 --timeout 5m
|
||||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||||
|
|
|
@ -47,6 +47,7 @@ linters:
|
||||||
#
|
#
|
||||||
# Enabled
|
# Enabled
|
||||||
#
|
#
|
||||||
|
# - asasalint # check for pass []any as any in variadic func(...any)
|
||||||
# - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
|
# - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers
|
||||||
# - bidichk # Checks for dangerous unicode character sequences
|
# - bidichk # Checks for dangerous unicode character sequences
|
||||||
# - decorder # check declaration order and count of types, constants, variables and functions
|
# - decorder # check declaration order and count of types, constants, variables and functions
|
||||||
|
@ -71,6 +72,7 @@ linters:
|
||||||
# - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
|
# - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes
|
||||||
# - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
|
# - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code
|
||||||
# - unconvert # Remove unnecessary type conversions
|
# - unconvert # Remove unnecessary type conversions
|
||||||
|
# - usestdlibvars # A linter that detect the possibility to use variables/constants from the Go standard library.
|
||||||
# - varcheck # Finds unused global variables and constants
|
# - varcheck # Finds unused global variables and constants
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -161,6 +163,7 @@ linters:
|
||||||
- exhaustruct # Checks if all structure fields are initialized
|
- exhaustruct # Checks if all structure fields are initialized
|
||||||
- goconst # Finds repeated strings that could be replaced by a constant
|
- goconst # Finds repeated strings that could be replaced by a constant
|
||||||
- stylecheck # Stylecheck is a replacement for golint
|
- stylecheck # Stylecheck is a replacement for golint
|
||||||
|
- nosnakecase # nosnakecase is a linter that detects snake case of variable naming and function name.
|
||||||
|
|
||||||
#
|
#
|
||||||
# Under evaluation
|
# Under evaluation
|
||||||
|
@ -168,7 +171,6 @@ linters:
|
||||||
|
|
||||||
- prealloc # Finds slice declarations that could potentially be preallocated
|
- prealloc # Finds slice declarations that could potentially be preallocated
|
||||||
|
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
max-issues-per-linter: 0
|
max-issues-per-linter: 0
|
||||||
max-same-issues: 10
|
max-same-issues: 10
|
||||||
|
|
|
@ -3,6 +3,7 @@ package apiclient
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/models"
|
"github.com/crowdsecurity/crowdsec/pkg/models"
|
||||||
qs "github.com/google/go-querystring/query"
|
qs "github.com/google/go-querystring/query"
|
||||||
|
@ -52,7 +53,7 @@ func (s *AlertsService) Add(ctx context.Context, alerts models.AddAlertsRequest)
|
||||||
var added_ids models.AddAlertsResponse
|
var added_ids models.AddAlertsResponse
|
||||||
|
|
||||||
u := fmt.Sprintf("%s/alerts", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/alerts", s.client.URLPrefix)
|
||||||
req, err := s.client.NewRequest("POST", u, &alerts)
|
req, err := s.client.NewRequest(http.MethodPost, u, &alerts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -79,7 +80,7 @@ func (s *AlertsService) List(ctx context.Context, opts AlertsListOpts) (*models.
|
||||||
URI = u
|
URI = u
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := s.client.NewRequest("GET", URI, nil)
|
req, err := s.client.NewRequest(http.MethodGet, URI, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, errors.Wrap(err, "building request")
|
return nil, nil, errors.Wrap(err, "building request")
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,7 @@ func (s *AlertsService) Delete(ctx context.Context, opts AlertsDeleteOpts) (*mod
|
||||||
}
|
}
|
||||||
u := fmt.Sprintf("%s/alerts?%s", s.client.URLPrefix, params.Encode())
|
u := fmt.Sprintf("%s/alerts?%s", s.client.URLPrefix, params.Encode())
|
||||||
|
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,7 @@ func (s *AlertsService) GetByID(ctx context.Context, alertID int) (*models.Alert
|
||||||
var alert models.Alert
|
var alert models.Alert
|
||||||
u := fmt.Sprintf("%s/alerts/%d", s.client.URLPrefix, alertID)
|
u := fmt.Sprintf("%s/alerts/%d", s.client.URLPrefix, alertID)
|
||||||
|
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest(http.MethodGet, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ func (t *JWTTransport) refreshJwtToken() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "could not encode jwt auth body")
|
return errors.Wrap(err, "could not encode jwt auth body")
|
||||||
}
|
}
|
||||||
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s/watchers/login", t.URL, t.VersionPrefix), buf)
|
req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("%s%s/watchers/login", t.URL, t.VersionPrefix), buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "could not create request")
|
return errors.Wrap(err, "could not create request")
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package apiclient
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/models"
|
"github.com/crowdsecurity/crowdsec/pkg/models"
|
||||||
)
|
)
|
||||||
|
@ -22,7 +23,7 @@ type enrollRequest struct {
|
||||||
func (s *AuthService) UnregisterWatcher(ctx context.Context) (*Response, error) {
|
func (s *AuthService) UnregisterWatcher(ctx context.Context) (*Response, error) {
|
||||||
|
|
||||||
u := fmt.Sprintf("%s/watchers", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/watchers", s.client.URLPrefix)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -38,7 +39,7 @@ func (s *AuthService) RegisterWatcher(ctx context.Context, registration models.W
|
||||||
|
|
||||||
u := fmt.Sprintf("%s/watchers", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/watchers", s.client.URLPrefix)
|
||||||
|
|
||||||
req, err := s.client.NewRequest("POST", u, ®istration)
|
req, err := s.client.NewRequest(http.MethodPost, u, ®istration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -52,7 +53,7 @@ func (s *AuthService) RegisterWatcher(ctx context.Context, registration models.W
|
||||||
|
|
||||||
func (s *AuthService) AuthenticateWatcher(ctx context.Context, auth models.WatcherAuthRequest) (*Response, error) {
|
func (s *AuthService) AuthenticateWatcher(ctx context.Context, auth models.WatcherAuthRequest) (*Response, error) {
|
||||||
u := fmt.Sprintf("%s/watchers/login", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/watchers/login", s.client.URLPrefix)
|
||||||
req, err := s.client.NewRequest("POST", u, &auth)
|
req, err := s.client.NewRequest(http.MethodPost, u, &auth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -66,7 +67,7 @@ func (s *AuthService) AuthenticateWatcher(ctx context.Context, auth models.Watch
|
||||||
|
|
||||||
func (s *AuthService) EnrollWatcher(ctx context.Context, enrollKey string, name string, tags []string, overwrite bool) (*Response, error) {
|
func (s *AuthService) EnrollWatcher(ctx context.Context, enrollKey string, name string, tags []string, overwrite bool) (*Response, error) {
|
||||||
u := fmt.Sprintf("%s/watchers/enroll", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/watchers/enroll", s.client.URLPrefix)
|
||||||
req, err := s.client.NewRequest("POST", u, &enrollRequest{EnrollKey: enrollKey, Name: name, Tags: tags, Overwrite: overwrite})
|
req, err := s.client.NewRequest(http.MethodPost, u, &enrollRequest{EnrollKey: enrollKey, Name: name, Tags: tags, Overwrite: overwrite})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package apiclient
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/models"
|
"github.com/crowdsecurity/crowdsec/pkg/models"
|
||||||
qs "github.com/google/go-querystring/query"
|
qs "github.com/google/go-querystring/query"
|
||||||
|
@ -55,7 +56,7 @@ func (s *DecisionsService) List(ctx context.Context, opts DecisionsListOpts) (*m
|
||||||
}
|
}
|
||||||
u := fmt.Sprintf("%s/decisions?%s", s.client.URLPrefix, params.Encode())
|
u := fmt.Sprintf("%s/decisions?%s", s.client.URLPrefix, params.Encode())
|
||||||
|
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest(http.MethodGet, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -73,7 +74,7 @@ func (s *DecisionsService) GetStream(ctx context.Context, opts DecisionsStreamOp
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
req, err := s.client.NewRequest("GET", u, nil)
|
req, err := s.client.NewRequest(http.MethodGet, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ func (s *DecisionsService) GetStream(ctx context.Context, opts DecisionsStreamOp
|
||||||
func (s *DecisionsService) StopStream(ctx context.Context) (*Response, error) {
|
func (s *DecisionsService) StopStream(ctx context.Context) (*Response, error) {
|
||||||
|
|
||||||
u := fmt.Sprintf("%s/decisions", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/decisions", s.client.URLPrefix)
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -109,7 +110,7 @@ func (s *DecisionsService) Delete(ctx context.Context, opts DecisionsDeleteOpts)
|
||||||
}
|
}
|
||||||
u := fmt.Sprintf("%s/decisions?%s", s.client.URLPrefix, params.Encode())
|
u := fmt.Sprintf("%s/decisions?%s", s.client.URLPrefix, params.Encode())
|
||||||
|
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -125,7 +126,7 @@ func (s *DecisionsService) DeleteOne(ctx context.Context, decision_id string) (*
|
||||||
var deleteDecisionResponse models.DeleteDecisionResponse
|
var deleteDecisionResponse models.DeleteDecisionResponse
|
||||||
u := fmt.Sprintf("%s/decisions/%s", s.client.URLPrefix, decision_id)
|
u := fmt.Sprintf("%s/decisions/%s", s.client.URLPrefix, decision_id)
|
||||||
|
|
||||||
req, err := s.client.NewRequest("DELETE", u, nil)
|
req, err := s.client.NewRequest(http.MethodDelete, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ func (h *HeartBeatService) Ping(ctx context.Context) (bool, *Response, error) {
|
||||||
|
|
||||||
u := fmt.Sprintf("%s/heartbeat", h.client.URLPrefix)
|
u := fmt.Sprintf("%s/heartbeat", h.client.URLPrefix)
|
||||||
|
|
||||||
req, err := h.client.NewRequest("GET", u, nil)
|
req, err := h.client.NewRequest(http.MethodGet, u, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package apiclient
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/crowdsecurity/crowdsec/pkg/models"
|
"github.com/crowdsecurity/crowdsec/pkg/models"
|
||||||
)
|
)
|
||||||
|
@ -13,7 +14,7 @@ func (s *MetricsService) Add(ctx context.Context, metrics *models.Metrics) (inte
|
||||||
var response interface{}
|
var response interface{}
|
||||||
|
|
||||||
u := fmt.Sprintf("%s/metrics/", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/metrics/", s.client.URLPrefix)
|
||||||
req, err := s.client.NewRequest("POST", u, &metrics)
|
req, err := s.client.NewRequest(http.MethodPost, u, &metrics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package apiclient
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ func (s *SignalService) Add(ctx context.Context, signals *models.AddSignalsReque
|
||||||
var response interface{}
|
var response interface{}
|
||||||
|
|
||||||
u := fmt.Sprintf("%s/signals", s.client.URLPrefix)
|
u := fmt.Sprintf("%s/signals", s.client.URLPrefix)
|
||||||
req, err := s.client.NewRequest("POST", u, &signals)
|
req, err := s.client.NewRequest(http.MethodPost, u, &signals)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, errors.Wrap(err, "while building request")
|
return nil, nil, errors.Wrap(err, "while building request")
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ func SetupLAPITest(t *testing.T) LAPI {
|
||||||
|
|
||||||
func (l *LAPI) InsertAlertFromFile(path string) *httptest.ResponseRecorder {
|
func (l *LAPI) InsertAlertFromFile(path string) *httptest.ResponseRecorder {
|
||||||
alertReader := GetAlertReaderFromFile(path)
|
alertReader := GetAlertReaderFromFile(path)
|
||||||
return l.RecordResponse("POST", "/v1/alerts", alertReader, "password")
|
return l.RecordResponse(http.MethodPost, "/v1/alerts", alertReader, "password")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *LAPI) RecordResponse(verb string, url string, body *strings.Reader, authType string) *httptest.ResponseRecorder {
|
func (l *LAPI) RecordResponse(verb string, url string, body *strings.Reader, authType string) *httptest.ResponseRecorder {
|
||||||
|
@ -92,7 +92,7 @@ func LoginToTestAPI(router *gin.Engine, config csconfig.Config) (models.WatcherA
|
||||||
}
|
}
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers/login", strings.NewReader(body))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -132,14 +132,14 @@ func TestCreateAlert(t *testing.T) {
|
||||||
lapi := SetupLAPITest(t)
|
lapi := SetupLAPITest(t)
|
||||||
// Create Alert with invalid format
|
// Create Alert with invalid format
|
||||||
|
|
||||||
w := lapi.RecordResponse("POST", "/v1/alerts", strings.NewReader("test"), "password")
|
w := lapi.RecordResponse(http.MethodPost, "/v1/alerts", strings.NewReader("test"), "password")
|
||||||
assert.Equal(t, 400, w.Code)
|
assert.Equal(t, 400, w.Code)
|
||||||
assert.Equal(t, "{\"message\":\"invalid character 'e' in literal true (expecting 'r')\"}", w.Body.String())
|
assert.Equal(t, "{\"message\":\"invalid character 'e' in literal true (expecting 'r')\"}", w.Body.String())
|
||||||
|
|
||||||
// Create Alert with invalid input
|
// Create Alert with invalid input
|
||||||
alertContent := GetAlertReaderFromFile("./tests/invalidAlert_sample.json")
|
alertContent := GetAlertReaderFromFile("./tests/invalidAlert_sample.json")
|
||||||
|
|
||||||
w = lapi.RecordResponse("POST", "/v1/alerts", alertContent, "password")
|
w = lapi.RecordResponse(http.MethodPost, "/v1/alerts", alertContent, "password")
|
||||||
assert.Equal(t, 500, w.Code)
|
assert.Equal(t, 500, w.Code)
|
||||||
assert.Equal(t, "{\"message\":\"validation failure list:\\n0.scenario in body is required\\n0.scenario_hash in body is required\\n0.scenario_version in body is required\\n0.simulated in body is required\\n0.source in body is required\"}", w.Body.String())
|
assert.Equal(t, "{\"message\":\"validation failure list:\\n0.scenario in body is required\\n0.scenario_hash in body is required\\n0.scenario_version in body is required\\n0.simulated in body is required\\n0.source in body is required\"}", w.Body.String())
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ func TestCreateAlertErrors(t *testing.T) {
|
||||||
|
|
||||||
//test invalid bearer
|
//test invalid bearer
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/alerts", alertContent)
|
req, _ := http.NewRequest(http.MethodPost, "/v1/alerts", alertContent)
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", "ratata"))
|
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", "ratata"))
|
||||||
lapi.router.ServeHTTP(w, req)
|
lapi.router.ServeHTTP(w, req)
|
||||||
|
@ -388,7 +388,7 @@ func TestCreateAlertErrors(t *testing.T) {
|
||||||
|
|
||||||
//test invalid bearer
|
//test invalid bearer
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/alerts", alertContent)
|
req, _ = http.NewRequest(http.MethodPost, "/v1/alerts", alertContent)
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", lapi.loginResp.Token+"s"))
|
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", lapi.loginResp.Token+"s"))
|
||||||
lapi.router.ServeHTTP(w, req)
|
lapi.router.ServeHTTP(w, req)
|
||||||
|
@ -402,7 +402,7 @@ func TestDeleteAlert(t *testing.T) {
|
||||||
|
|
||||||
// Fail Delete Alert
|
// Fail Delete Alert
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("DELETE", "/v1/alerts", strings.NewReader(""))
|
req, _ := http.NewRequest(http.MethodDelete, "/v1/alerts", strings.NewReader(""))
|
||||||
AddAuthHeaders(req, lapi.loginResp)
|
AddAuthHeaders(req, lapi.loginResp)
|
||||||
req.RemoteAddr = "127.0.0.2:4242"
|
req.RemoteAddr = "127.0.0.2:4242"
|
||||||
lapi.router.ServeHTTP(w, req)
|
lapi.router.ServeHTTP(w, req)
|
||||||
|
@ -411,7 +411,7 @@ func TestDeleteAlert(t *testing.T) {
|
||||||
|
|
||||||
// Delete Alert
|
// Delete Alert
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("DELETE", "/v1/alerts", strings.NewReader(""))
|
req, _ = http.NewRequest(http.MethodDelete, "/v1/alerts", strings.NewReader(""))
|
||||||
AddAuthHeaders(req, lapi.loginResp)
|
AddAuthHeaders(req, lapi.loginResp)
|
||||||
req.RemoteAddr = "127.0.0.1:4242"
|
req.RemoteAddr = "127.0.0.1:4242"
|
||||||
lapi.router.ServeHTTP(w, req)
|
lapi.router.ServeHTTP(w, req)
|
||||||
|
@ -449,7 +449,7 @@ func TestDeleteAlertTrustedIPS(t *testing.T) {
|
||||||
|
|
||||||
assertAlertDeleteFailedFromIP := func(ip string) {
|
assertAlertDeleteFailedFromIP := func(ip string) {
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("DELETE", "/v1/alerts", strings.NewReader(""))
|
req, _ := http.NewRequest(http.MethodDelete, "/v1/alerts", strings.NewReader(""))
|
||||||
|
|
||||||
AddAuthHeaders(req, loginResp)
|
AddAuthHeaders(req, loginResp)
|
||||||
req.RemoteAddr = ip + ":1234"
|
req.RemoteAddr = ip + ":1234"
|
||||||
|
@ -461,7 +461,7 @@ func TestDeleteAlertTrustedIPS(t *testing.T) {
|
||||||
|
|
||||||
assertAlertDeletedFromIP := func(ip string) {
|
assertAlertDeletedFromIP := func(ip string) {
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("DELETE", "/v1/alerts", strings.NewReader(""))
|
req, _ := http.NewRequest(http.MethodDelete, "/v1/alerts", strings.NewReader(""))
|
||||||
AddAuthHeaders(req, loginResp)
|
AddAuthHeaders(req, loginResp)
|
||||||
req.RemoteAddr = ip + ":1234"
|
req.RemoteAddr = ip + ":1234"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ func TestAPIKey(t *testing.T) {
|
||||||
}
|
}
|
||||||
// Login with empty token
|
// Login with empty token
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/v1/decisions", strings.NewReader(""))
|
req, _ := http.NewRequest(http.MethodGet, "/v1/decisions", strings.NewReader(""))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ func TestAPIKey(t *testing.T) {
|
||||||
|
|
||||||
// Login with invalid token
|
// Login with invalid token
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("GET", "/v1/decisions", strings.NewReader(""))
|
req, _ = http.NewRequest(http.MethodGet, "/v1/decisions", strings.NewReader(""))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
req.Header.Add("X-Api-Key", "a1b2c3d4e5f6")
|
req.Header.Add("X-Api-Key", "a1b2c3d4e5f6")
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
@ -41,7 +41,7 @@ func TestAPIKey(t *testing.T) {
|
||||||
|
|
||||||
// Login with valid token
|
// Login with valid token
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("GET", "/v1/decisions", strings.NewReader(""))
|
req, _ = http.NewRequest(http.MethodGet, "/v1/decisions", strings.NewReader(""))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
req.Header.Add("X-Api-Key", APIKey)
|
req.Header.Add("X-Api-Key", APIKey)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
|
@ -260,7 +260,7 @@ func CreateTestMachine(router *gin.Engine) (string, error) {
|
||||||
body := string(b)
|
body := string(b)
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers", strings.NewReader(body))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader(body))
|
||||||
req.Header.Set("User-Agent", UserAgent)
|
req.Header.Set("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
return body, nil
|
return body, nil
|
||||||
|
@ -309,7 +309,7 @@ func TestUnknownPath(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test", nil)
|
req, _ := http.NewRequest(http.MethodGet, "/test", nil)
|
||||||
req.Header.Set("User-Agent", UserAgent)
|
req.Header.Set("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ func TestLoggingDebugToFileConfig(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test42", nil)
|
req, _ := http.NewRequest(http.MethodGet, "/test42", nil)
|
||||||
req.Header.Set("User-Agent", UserAgent)
|
req.Header.Set("User-Agent", UserAgent)
|
||||||
api.router.ServeHTTP(w, req)
|
api.router.ServeHTTP(w, req)
|
||||||
assert.Equal(t, 404, w.Code)
|
assert.Equal(t, 404, w.Code)
|
||||||
|
@ -426,7 +426,7 @@ func TestLoggingErrorToFileConfig(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("GET", "/test42", nil)
|
req, _ := http.NewRequest(http.MethodGet, "/test42", nil)
|
||||||
req.Header.Set("User-Agent", UserAgent)
|
req.Header.Set("User-Agent", UserAgent)
|
||||||
api.router.ServeHTTP(w, req)
|
api.router.ServeHTTP(w, req)
|
||||||
assert.Equal(t, 404, w.Code)
|
assert.Equal(t, 404, w.Code)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package apiserver
|
package apiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -9,7 +10,7 @@ import (
|
||||||
func TestHeartBeat(t *testing.T) {
|
func TestHeartBeat(t *testing.T) {
|
||||||
lapi := SetupLAPITest(t)
|
lapi := SetupLAPITest(t)
|
||||||
|
|
||||||
w := lapi.RecordResponse("GET", "/v1/heartbeat", emptyBody, "password")
|
w := lapi.RecordResponse(http.MethodGet, "/v1/heartbeat", emptyBody, "password")
|
||||||
assert.Equal(t, 200, w.Code)
|
assert.Equal(t, 200, w.Code)
|
||||||
|
|
||||||
w = lapi.RecordResponse("POST", "/v1/heartbeat", emptyBody, "password")
|
w = lapi.RecordResponse("POST", "/v1/heartbeat", emptyBody, "password")
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestLogin(t *testing.T) {
|
||||||
|
|
||||||
// Login with machine not validated yet
|
// Login with machine not validated yet
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers/login", strings.NewReader(body))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ func TestLogin(t *testing.T) {
|
||||||
|
|
||||||
// Login with machine not exist
|
// Login with machine not exist
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\", \"password\": \"test1\"}"))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\", \"password\": \"test1\"}"))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ func TestLogin(t *testing.T) {
|
||||||
|
|
||||||
// Login with invalid body
|
// Login with invalid body
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("test"))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("test"))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ func TestLogin(t *testing.T) {
|
||||||
|
|
||||||
// Login with invalid format
|
// Login with invalid format
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\"}"))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test1\"}"))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ func TestLogin(t *testing.T) {
|
||||||
|
|
||||||
// Login with invalid password
|
// Login with invalid password
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test1\"}"))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test1\"}"))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ func TestLogin(t *testing.T) {
|
||||||
|
|
||||||
// Login with valid machine
|
// Login with valid machine
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader(body))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ func TestLogin(t *testing.T) {
|
||||||
|
|
||||||
// Login with valid machine + scenarios
|
// Login with valid machine + scenarios
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test\", \"scenarios\": [\"crowdsecurity/test\", \"crowdsecurity/test2\"]}"))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers/login", strings.NewReader("{\"machine_id\": \"test\", \"password\": \"test\", \"scenarios\": [\"crowdsecurity/test\", \"crowdsecurity/test2\"]}"))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestCreateMachine(t *testing.T) {
|
||||||
|
|
||||||
// Create machine with invalid format
|
// Create machine with invalid format
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers", strings.NewReader("test"))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader("test"))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ func TestCreateMachine(t *testing.T) {
|
||||||
|
|
||||||
// Create machine with invalid input
|
// Create machine with invalid input
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers", strings.NewReader("{\"test\": \"test\"}"))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader("{\"test\": \"test\"}"))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ func TestCreateMachine(t *testing.T) {
|
||||||
body := string(b)
|
body := string(b)
|
||||||
|
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers", strings.NewReader(body))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ func TestCreateMachineWithForwardedFor(t *testing.T) {
|
||||||
body := string(b)
|
body := string(b)
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers", strings.NewReader(body))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
req.Header.Add("X-Real-Ip", "1.1.1.1")
|
req.Header.Add("X-Real-Ip", "1.1.1.1")
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
@ -95,7 +95,7 @@ func TestCreateMachineWithForwardedForNoConfig(t *testing.T) {
|
||||||
body := string(b)
|
body := string(b)
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers", strings.NewReader(body))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
req.Header.Add("X-Real-IP", "1.1.1.1")
|
req.Header.Add("X-Real-IP", "1.1.1.1")
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
@ -126,7 +126,7 @@ func TestCreateMachineWithoutForwardedFor(t *testing.T) {
|
||||||
body := string(b)
|
body := string(b)
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers", strings.NewReader(body))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
@ -154,12 +154,12 @@ func TestCreateMachineAlreadyExist(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
req, _ := http.NewRequest("POST", "/v1/watchers", strings.NewReader(body))
|
req, _ := http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
w = httptest.NewRecorder()
|
w = httptest.NewRecorder()
|
||||||
req, _ = http.NewRequest("POST", "/v1/watchers", strings.NewReader(body))
|
req, _ = http.NewRequest(http.MethodPost, "/v1/watchers", strings.NewReader(body))
|
||||||
req.Header.Add("User-Agent", UserAgent)
|
req.Header.Add("User-Agent", UserAgent)
|
||||||
router.ServeHTTP(w, req)
|
router.ServeHTTP(w, req)
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ func UpdateHubIdx(hub *csconfig.Hub) error {
|
||||||
|
|
||||||
func DownloadHubIdx(hub *csconfig.Hub) ([]byte, error) {
|
func DownloadHubIdx(hub *csconfig.Hub) ([]byte, error) {
|
||||||
log.Debugf("fetching index from branch %s (%s)", HubBranch, fmt.Sprintf(RawFileURLTemplate, HubBranch, HubIndexFile))
|
log.Debugf("fetching index from branch %s (%s)", HubBranch, fmt.Sprintf(RawFileURLTemplate, HubBranch, HubIndexFile))
|
||||||
req, err := http.NewRequest("GET", fmt.Sprintf(RawFileURLTemplate, HubBranch, HubIndexFile), nil)
|
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf(RawFileURLTemplate, HubBranch, HubIndexFile), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to build request for hub index")
|
return nil, errors.Wrap(err, "failed to build request for hub index")
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ func DownloadItem(hub *csconfig.Hub, target Item, overwrite bool) (Item, error)
|
||||||
// We still have to check if data files are present
|
// We still have to check if data files are present
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
req, err := http.NewRequest("GET", fmt.Sprintf(RawFileURLTemplate, HubBranch, target.RemotePath), nil)
|
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf(RawFileURLTemplate, HubBranch, target.RemotePath), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return target, errors.Wrap(err, fmt.Sprintf("while downloading %s", req.URL.String()))
|
return target, errors.Wrap(err, fmt.Sprintf("while downloading %s", req.URL.String()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,7 @@ func (m *Metabase) DownloadDatabase(force bool) error {
|
||||||
return fmt.Errorf("failed to create %s : %s", metabaseDBSubpath, err)
|
return fmt.Errorf("failed to create %s : %s", metabaseDBSubpath, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest("GET", m.InternalDBURL, nil)
|
req, err := http.NewRequest(http.MethodGet, m.InternalDBURL, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to build request to fetch metabase db : %s", err)
|
return fmt.Errorf("failed to build request to fetch metabase db : %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ type DataSet struct {
|
||||||
|
|
||||||
func downloadFile(url string, destPath string) error {
|
func downloadFile(url string, destPath string) error {
|
||||||
log.Debugf("downloading %s in %s", url, destPath)
|
log.Debugf("downloading %s in %s", url, destPath)
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue