Skip to content

Commit

Permalink
fix golang-ci lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylfrena committed Nov 24, 2022
1 parent 460158f commit c07d9d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions pkg/buildid/buildid.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ func BuildID(f *elf.File, path string) (string, error) {
}

if hasGoBuildIDSection {
//f.Close()

if id, err := fastGoBuildID(f); err == nil && len(id) > 0 {
return hex.EncodeToString(id), nil
}
Expand All @@ -57,8 +55,6 @@ func BuildID(f *elf.File, path string) (string, error) {

return hex.EncodeToString([]byte(id)), nil
}
//f.Close()

if id, err := fastGNUBuildID(f); err == nil && len(id) > 0 {
return hex.EncodeToString(id), nil
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/process/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@ func (c *mappingFileCache) mappingForPID(pid int) ([]*profile.Mapping, error) {

abs := path.Join(fmt.Sprintf("/proc/%d/root", pid), m.File)

f_elf, err := elf.Open(abs)
fElf, err := elf.Open(abs)
if err != nil {
if !errors.Is(err, os.ErrNotExist) {
level.Debug(c.logger).Log("msg", "failed to read object elf file", "object", abs, "err", err)
}
continue
}
defer f_elf.Close()
defer fElf.Close()

m.BuildID, err = buildid.BuildID(f_elf, abs)
m.BuildID, err = buildid.BuildID(fElf, abs)
if err != nil {
if !errors.Is(err, os.ErrNotExist) {
level.Debug(c.logger).Log("msg", "failed to read object build ID", "object", abs, "err", err)
Expand Down

0 comments on commit c07d9d3

Please sign in to comment.