Skip to content

Commit

Permalink
[chore] clarify err variable scope (#3627)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Jan 20, 2025
1 parent 8dbe6ea commit 700d732
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmd/otel-allocator/target/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,10 @@ func (m *Discoverer) Close() {
// Calculate a hash for a scrape config map.
// This is done by marshaling to YAML because it's the most straightforward and doesn't run into problems with unexported fields.
func getScrapeConfigHash(jobToScrapeConfig map[string]*promconfig.ScrapeConfig) (hash.Hash64, error) {
var err error
hash := fnv.New64()
yamlEncoder := yaml.NewEncoder(hash)
for jobName, scrapeConfig := range jobToScrapeConfig {
_, err = hash.Write([]byte(jobName))
_, err := hash.Write([]byte(jobName))
if err != nil {
return nil, err
}
Expand All @@ -266,5 +265,5 @@ func getScrapeConfigHash(jobToScrapeConfig map[string]*promconfig.ScrapeConfig)
}
}
yamlEncoder.Close()
return hash, err
return hash, nil
}

0 comments on commit 700d732

Please sign in to comment.