Make linters happy and disable deprecated exhaustivestruct.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9d5d5c262e
commit
dc1287dae8
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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",
|
||||
|
@ -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{}),
|
||||
|
@ -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),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user