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
|
- gomnd
|
||||||
# Why? WHY? WHY _test???
|
# Why? WHY? WHY _test???
|
||||||
- testpackage
|
- testpackage
|
||||||
|
# Structs will contain some context.Context.
|
||||||
|
- containedctx
|
||||||
|
# Deprecated
|
||||||
|
- exhaustivestruct
|
||||||
linters-settings:
|
linters-settings:
|
||||||
lll:
|
lll:
|
||||||
line-length: 120
|
line-length: 120
|
||||||
|
@ -29,7 +29,7 @@ type Application struct {
|
|||||||
// NewApplication creates new application.
|
// NewApplication creates new application.
|
||||||
func NewApplication(ctx context.Context, name string, config *Config, logger *logger.Logger) *Application {
|
func NewApplication(ctx context.Context, name string, config *Config, logger *logger.Logger) *Application {
|
||||||
// Some variables are initialized in initialize() function.
|
// Some variables are initialized in initialize() function.
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
app := &Application{
|
app := &Application{
|
||||||
config: config,
|
config: config,
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
|
@ -64,7 +64,7 @@ func (a *Application) fetch() {
|
|||||||
func (a *Application) startFetcher() {
|
func (a *Application) startFetcher() {
|
||||||
fetchTicker := time.NewTicker(a.config.TimeBetweenRequests)
|
fetchTicker := time.NewTicker(a.config.TimeBetweenRequests)
|
||||||
|
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
a.httpClient = &http.Client{
|
a.httpClient = &http.Client{
|
||||||
Timeout: time.Second * 5,
|
Timeout: time.Second * 5,
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ type Config struct {
|
|||||||
// NewConfig returns new configuration.
|
// NewConfig returns new configuration.
|
||||||
func NewConfig() *Config {
|
func NewConfig() *Config {
|
||||||
// Fields are initialized when parsing YAML file.
|
// Fields are initialized when parsing YAML file.
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
c := &Config{}
|
c := &Config{}
|
||||||
c.initialize()
|
c.initialize()
|
||||||
|
|
||||||
|
@ -167,6 +167,7 @@ func (h *handler) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
|
|||||||
Version: common.Version,
|
Version: common.Version,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:errchkjson
|
||||||
infoBytes, _ := json.Marshal(infoData)
|
infoBytes, _ := json.Marshal(infoData)
|
||||||
|
|
||||||
writer.WriteHeader(http.StatusOK)
|
writer.WriteHeader(http.StatusOK)
|
||||||
|
@ -25,7 +25,7 @@ type HTTPServer struct {
|
|||||||
// NewHTTPServer creates HTTP server and executes preliminary initialization
|
// NewHTTPServer creates HTTP server and executes preliminary initialization
|
||||||
// (HTTP server structure initialized but it doesn't start).
|
// (HTTP server structure initialized but it doesn't start).
|
||||||
func NewHTTPServer(ctx context.Context, cfg *configuration.Config, logger *logger.Logger) (*HTTPServer, chan struct{}) {
|
func NewHTTPServer(ctx context.Context, cfg *configuration.Config, logger *logger.Logger) (*HTTPServer, chan struct{}) {
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
httpServer := &HTTPServer{
|
httpServer := &HTTPServer{
|
||||||
config: cfg,
|
config: cfg,
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
@ -51,7 +51,7 @@ func (h *HTTPServer) initialize() {
|
|||||||
handlers: make(map[string]common.HTTPHandlerFunc),
|
handlers: make(map[string]common.HTTPHandlerFunc),
|
||||||
}
|
}
|
||||||
// We do not need to specify all possible parameters for HTTP server, so:
|
// We do not need to specify all possible parameters for HTTP server, so:
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
h.server = &http.Server{
|
h.server = &http.Server{
|
||||||
// ToDo: make it all configurable.
|
// ToDo: make it all configurable.
|
||||||
Addr: ":34421",
|
Addr: ":34421",
|
||||||
|
@ -24,7 +24,7 @@ type Storage struct {
|
|||||||
|
|
||||||
// NewStorage creates new in-memory storage to use.
|
// NewStorage creates new in-memory storage to use.
|
||||||
func NewStorage(ctx context.Context, name string, logger *logger.Logger) (*Storage, chan struct{}) {
|
func NewStorage(ctx context.Context, name string, logger *logger.Logger) (*Storage, chan struct{}) {
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
storage := &Storage{
|
storage := &Storage{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
doneChan: make(chan struct{}),
|
doneChan: make(chan struct{}),
|
||||||
|
@ -23,7 +23,7 @@ type Client struct {
|
|||||||
|
|
||||||
// NewClient creates new Metricator client.
|
// NewClient creates new Metricator client.
|
||||||
func NewClient(config *Config, logger *logger.Logger) *Client {
|
func NewClient(config *Config, logger *logger.Logger) *Client {
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
client := &Client{
|
client := &Client{
|
||||||
config: config,
|
config: config,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@ -140,7 +140,7 @@ func (c *Client) GetMetricsList(appName string) schema.Metrics {
|
|||||||
// Initializes internal states and storages.
|
// Initializes internal states and storages.
|
||||||
func (c *Client) initialize() {
|
func (c *Client) initialize() {
|
||||||
// We do not need to set everything for client actually, so:
|
// We do not need to set everything for client actually, so:
|
||||||
// nolint:exhaustivestruct
|
// nolint:exhaustruct
|
||||||
c.httpClient = &http.Client{
|
c.httpClient = &http.Client{
|
||||||
Timeout: time.Second * time.Duration(c.config.Timeout),
|
Timeout: time.Second * time.Duration(c.config.Timeout),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user