Skip to content

Commit

Permalink
Merge pull request #162 from behouba/lint-fixes
Browse files Browse the repository at this point in the history
chore: fix linting issues
  • Loading branch information
rst0git committed Mar 4, 2024
2 parents 771e3d7 + d52ba61 commit 5d0d8f1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions crit/explore.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func (c *crit) ExploreRss() ([]*RssMap, error) {
for _, pagemapEntry := range pagemapImg.Entries[1:] {
pagemapData := pagemapEntry.Message.(*pagemap.PagemapEntry)
rss := Rss{
PhyAddr: fmt.Sprintf("%x", pagemapData.GetVaddr()),
PhyAddr: strconv.FormatUint(pagemapData.GetVaddr(), 16),
PhyPages: int64(pagemapData.GetNrPages()),
}

Expand All @@ -347,7 +347,7 @@ func (c *crit) ExploreRss() ([]*RssMap, error) {
}

rss.Vmas = append(rss.Vmas, &Vma{
Addr: fmt.Sprintf("%x", vmas[vmaIndex].GetStart()),
Addr: strconv.FormatUint(vmas[vmaIndex].GetStart(), 16),
Pages: int64(vmas[vmaIndex].GetEnd()-vmas[vmaIndex].GetStart()) >> 12,
})
// Pages used by a file
Expand Down
4 changes: 2 additions & 2 deletions features.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package criu

import (
"fmt"
"errors"

"github.com/checkpoint-restore/go-criu/v7/rpc"
)
Expand Down Expand Up @@ -38,7 +38,7 @@ func (c *Criu) FeatureCheck(features *rpc.CriuFeatures) (*rpc.CriuFeatures, erro
}

if resp.GetType() != rpc.CriuReqType_FEATURE_CHECK {
return nil, fmt.Errorf("unexpected CRIU RPC response")
return nil, errors.New("unexpected CRIU RPC response")
}

return features, nil
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (c *Criu) GetCriuVersion() (int, error) {
}

if resp.GetType() != rpc.CriuReqType_VERSION {
return 0, fmt.Errorf("unexpected CRIU RPC response")
return 0, errors.New("unexpected CRIU RPC response")
}

version := resp.GetVersion().GetMajorNumber() * 10000
Expand Down
4 changes: 2 additions & 2 deletions test/crit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func recodeImgs(imgs []string) error {
return err
}
defer imgFile.Close()
testImg := fmt.Sprintf("%s.test.img", img)
testImg := img + ".test.img"
testImgFile, err := os.Create(testImg)
if err != nil {
return err
Expand Down Expand Up @@ -115,7 +115,7 @@ func getImgs() ([]string, error) {
// "*.test.img", "*.json.img" or "tmp.*.img" files
// must be skipped as they are generated by tests
criuImg := regexp.MustCompile(`^[^\.]*\.img$`)
dir, err := filepath.Glob(fmt.Sprintf("%s/*.img", loopTestImgDir))
dir, err := filepath.Glob(loopTestImgDir + "/*.img")
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 5d0d8f1

Please sign in to comment.