Make linters happy and disable deprecated exhaustivestruct.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Stanislav Nikitin 2022-06-29 13:00:38 +05:00
parent 9d5d5c262e
commit dc1287dae8
Signed by: pztrn
GPG Key ID: 1E944A0F0568B550
8 changed files with 13 additions and 8 deletions

View File

@ -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

View File

@ -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,

View File

@ -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,
}

View File

@ -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()

View File

@ -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)

View File

@ -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",

View File

@ -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{}),

View File

@ -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),
}