Skip to content

Commit 700d732

Browse files
authored
[chore] clarify err variable scope (#3627)
1 parent 8dbe6ea commit 700d732

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cmd/otel-allocator/target/discovery.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,10 @@ func (m *Discoverer) Close() {
252252
// Calculate a hash for a scrape config map.
253253
// This is done by marshaling to YAML because it's the most straightforward and doesn't run into problems with unexported fields.
254254
func getScrapeConfigHash(jobToScrapeConfig map[string]*promconfig.ScrapeConfig) (hash.Hash64, error) {
255-
var err error
256255
hash := fnv.New64()
257256
yamlEncoder := yaml.NewEncoder(hash)
258257
for jobName, scrapeConfig := range jobToScrapeConfig {
259-
_, err = hash.Write([]byte(jobName))
258+
_, err := hash.Write([]byte(jobName))
260259
if err != nil {
261260
return nil, err
262261
}
@@ -266,5 +265,5 @@ func getScrapeConfigHash(jobToScrapeConfig map[string]*promconfig.ScrapeConfig)
266265
}
267266
}
268267
yamlEncoder.Close()
269-
return hash, err
268+
return hash, nil
270269
}

0 commit comments

Comments
 (0)