Linting fixes.
This commit is contained in:
@@ -28,16 +28,18 @@ type Application struct {
|
||||
|
||||
// NewApplication creates new application.
|
||||
func NewApplication(ctx context.Context, name string, config *Config, logger *logger.Logger) *Application {
|
||||
a := &Application{
|
||||
// Some variables are initialized in initialize() function.
|
||||
// nolint:exhaustivestruct
|
||||
app := &Application{
|
||||
config: config,
|
||||
ctx: ctx,
|
||||
doneChan: make(chan struct{}),
|
||||
logger: logger,
|
||||
name: name,
|
||||
}
|
||||
a.initialize()
|
||||
app.initialize()
|
||||
|
||||
return a
|
||||
return app
|
||||
}
|
||||
|
||||
// GetDoneChan returns a channel which should be used to block execution until
|
||||
|
@@ -11,5 +11,6 @@ type Config struct {
|
||||
Endpoint string `yaml:"endpoint"`
|
||||
// TimeBetweenRequests is a minimal amount of time which should pass
|
||||
// between requests.
|
||||
// nolint:tagliatelle
|
||||
TimeBetweenRequests time.Duration `yaml:"time_between_requests"`
|
||||
}
|
||||
|
@@ -10,6 +10,9 @@ func (a *Application) fetch() {
|
||||
// Do not do anything if fetching is running.
|
||||
// ToDo: maybe another approach?
|
||||
a.fetchIsRunningMutex.RLock()
|
||||
// This is an optimization to avoid excessive waiting when using Lock().
|
||||
// Most of time application will wait between fetches.
|
||||
// nolint:ifshort
|
||||
isFetching := a.fetchIsRunning
|
||||
a.fetchIsRunningMutex.RUnlock()
|
||||
|
||||
|
@@ -143,8 +143,8 @@ func (a *Application) getParametersForPrometheusMetric(line string) []string {
|
||||
paramNameFinished, paramValueStarted, paramValueFinished bool
|
||||
)
|
||||
|
||||
for _, r := range valuesString {
|
||||
if paramValueFinished && string(r) == "," {
|
||||
for _, runeChar := range valuesString {
|
||||
if paramValueFinished && string(runeChar) == "," {
|
||||
params = append(params, paramName+":"+paramValue)
|
||||
paramName, paramValue = "", ""
|
||||
paramNameFinished, paramValueStarted, paramValueFinished = false, false, false
|
||||
@@ -156,8 +156,8 @@ func (a *Application) getParametersForPrometheusMetric(line string) []string {
|
||||
// "deeply nested"? I think not. So:
|
||||
// nolint:nestif
|
||||
if !paramNameFinished {
|
||||
if string(r) != "=" {
|
||||
paramName += string(r)
|
||||
if string(runeChar) != "=" {
|
||||
paramName += string(runeChar)
|
||||
|
||||
continue
|
||||
} else {
|
||||
@@ -166,19 +166,19 @@ func (a *Application) getParametersForPrometheusMetric(line string) []string {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if string(r) == "\"" && !paramValueStarted {
|
||||
if string(runeChar) == "\"" && !paramValueStarted {
|
||||
paramValueStarted = true
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if paramValueStarted && string(r) != "\"" {
|
||||
paramValue += string(r)
|
||||
if paramValueStarted && string(runeChar) != "\"" {
|
||||
paramValue += string(runeChar)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if paramValueStarted && string(r) == "\"" {
|
||||
if paramValueStarted && string(runeChar) == "\"" {
|
||||
paramValueFinished = true
|
||||
|
||||
continue
|
||||
|
Reference in New Issue
Block a user