diff --git a/.golangci.yml b/.golangci.yml index e16713a..0fe18cf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -9,6 +9,10 @@ linters: - gomnd # Why? WHY? WHY _test??? - testpackage + # Structs will contain some context.Context. + - containedctx + # Deprecated + - exhaustivestruct linters-settings: lll: line-length: 120 diff --git a/internal/application/application.go b/internal/application/application.go index 572218d..c85f5fe 100644 --- a/internal/application/application.go +++ b/internal/application/application.go @@ -29,7 +29,7 @@ type Application struct { // NewApplication creates new application. func NewApplication(ctx context.Context, name string, config *Config, logger *logger.Logger) *Application { // Some variables are initialized in initialize() function. - // nolint:exhaustivestruct + // nolint:exhaustruct app := &Application{ config: config, ctx: ctx, diff --git a/internal/application/fetcher.go b/internal/application/fetcher.go index 95346e9..7c62710 100644 --- a/internal/application/fetcher.go +++ b/internal/application/fetcher.go @@ -64,7 +64,7 @@ func (a *Application) fetch() { func (a *Application) startFetcher() { fetchTicker := time.NewTicker(a.config.TimeBetweenRequests) - // nolint:exhaustivestruct + // nolint:exhaustruct a.httpClient = &http.Client{ Timeout: time.Second * 5, } diff --git a/internal/configuration/config.go b/internal/configuration/config.go index d87fbb6..cf1234a 100644 --- a/internal/configuration/config.go +++ b/internal/configuration/config.go @@ -32,7 +32,7 @@ type Config struct { // NewConfig returns new configuration. func NewConfig() *Config { // Fields are initialized when parsing YAML file. - // nolint:exhaustivestruct + // nolint:exhaustruct c := &Config{} c.initialize() diff --git a/internal/httpserver/handler.go b/internal/httpserver/handler.go index e4b9a34..3a4693e 100644 --- a/internal/httpserver/handler.go +++ b/internal/httpserver/handler.go @@ -167,6 +167,7 @@ func (h *handler) ServeHTTP(writer http.ResponseWriter, req *http.Request) { Version: common.Version, } + // nolint:errchkjson infoBytes, _ := json.Marshal(infoData) writer.WriteHeader(http.StatusOK) diff --git a/internal/httpserver/httpserver.go b/internal/httpserver/httpserver.go index 41ec24c..3fcace3 100644 --- a/internal/httpserver/httpserver.go +++ b/internal/httpserver/httpserver.go @@ -25,7 +25,7 @@ type HTTPServer struct { // NewHTTPServer creates HTTP server and executes preliminary initialization // (HTTP server structure initialized but it doesn't start). func NewHTTPServer(ctx context.Context, cfg *configuration.Config, logger *logger.Logger) (*HTTPServer, chan struct{}) { - // nolint:exhaustivestruct + // nolint:exhaustruct httpServer := &HTTPServer{ config: cfg, ctx: ctx, @@ -51,7 +51,7 @@ func (h *HTTPServer) initialize() { handlers: make(map[string]common.HTTPHandlerFunc), } // We do not need to specify all possible parameters for HTTP server, so: - // nolint:exhaustivestruct + // nolint:exhaustruct h.server = &http.Server{ // ToDo: make it all configurable. Addr: ":34421", diff --git a/internal/storage/memory/memory.go b/internal/storage/memory/memory.go index ce16407..12f2f4e 100644 --- a/internal/storage/memory/memory.go +++ b/internal/storage/memory/memory.go @@ -24,7 +24,7 @@ type Storage struct { // NewStorage creates new in-memory storage to use. func NewStorage(ctx context.Context, name string, logger *logger.Logger) (*Storage, chan struct{}) { - // nolint:exhaustivestruct + // nolint:exhaustruct storage := &Storage{ ctx: ctx, doneChan: make(chan struct{}), diff --git a/pkg/client/client.go b/pkg/client/client.go index 236bfa5..79379f5 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -23,7 +23,7 @@ type Client struct { // NewClient creates new Metricator client. func NewClient(config *Config, logger *logger.Logger) *Client { - // nolint:exhaustivestruct + // nolint:exhaustruct client := &Client{ config: config, logger: logger, @@ -140,7 +140,7 @@ func (c *Client) GetMetricsList(appName string) schema.Metrics { // Initializes internal states and storages. func (c *Client) initialize() { // We do not need to set everything for client actually, so: - // nolint:exhaustivestruct + // nolint:exhaustruct c.httpClient = &http.Client{ Timeout: time.Second * time.Duration(c.config.Timeout), }