aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-09-10 12:34:20 +0200
committerTaras Madan <tarasmadan@google.com>2024-09-10 14:05:26 +0000
commit8c8b47c0c8cd80d1ff64780b9893d068439ead14 (patch)
tree440a17d052b790f801e0d1063f1763fcc465127d
parentc97c816133b42257d0bcf1ee4bd178bb2a7a2b9e (diff)
all: follow new linter recommendations
-rw-r--r--pkg/ast/parser.go2
-rw-r--r--pkg/ast/scanner.go16
-rw-r--r--pkg/bisect/bisect.go110
-rw-r--r--pkg/compiler/check.go2
-rw-r--r--pkg/log/log.go6
-rw-r--r--pkg/log/log_test.go2
-rw-r--r--pkg/runtest/run_test.go2
-rw-r--r--prog/encoding.go12
-rw-r--r--prog/hints_test.go2
-rw-r--r--prog/prio.go16
-rw-r--r--vm/starnix/starnix.go2
11 files changed, 94 insertions, 78 deletions
diff --git a/pkg/ast/parser.go b/pkg/ast/parser.go
index 2f2e62055..839d8e6d6 100644
--- a/pkg/ast/parser.go
+++ b/pkg/ast/parser.go
@@ -180,7 +180,7 @@ func (p *parser) expect(tokens ...token) {
for _, tok := range tokens {
str = append(str, tok.String())
}
- p.s.Error(p.pos, fmt.Sprintf("unexpected %v, expecting %v", p.tok, strings.Join(str, ", ")))
+ p.s.Errorf(p.pos, "unexpected %v, expecting %v", p.tok, strings.Join(str, ", "))
panic(errSkipLine)
}
diff --git a/pkg/ast/scanner.go b/pkg/ast/scanner.go
index 594b9ea8d..aaabb5bcc 100644
--- a/pkg/ast/scanner.go
+++ b/pkg/ast/scanner.go
@@ -195,7 +195,7 @@ func (s *scanner) Scan() (tok token, lit string, pos Pos) {
default:
tok = punctuation[s.ch]
if tok == tokIllegal {
- s.Error(pos, "illegal character %#U", s.ch)
+ s.Errorf(pos, "illegal character %#U", s.ch)
}
s.next()
}
@@ -212,7 +212,7 @@ func (s *scanner) scanStr(pos Pos) string {
}
for s.next(); s.ch != closing; s.next() {
if s.ch == 0 || s.ch == '\n' {
- s.Error(pos, "string literal is not terminated")
+ s.Errorf(pos, "string literal is not terminated")
return ""
}
}
@@ -222,7 +222,7 @@ func (s *scanner) scanStr(pos Pos) string {
pos1 := pos
pos1.Col += i + 1
pos1.Off += i + 1
- s.Error(pos1, "illegal character %#U in string literal", lit[i])
+ s.Errorf(pos1, "illegal character %#U in string literal", lit[i])
break
}
}
@@ -232,7 +232,7 @@ func (s *scanner) scanStr(pos Pos) string {
}
decoded, err := hex.DecodeString(lit)
if err != nil {
- s.Error(pos, "bad hex string literal: %v", err)
+ s.Errorf(pos, "bad hex string literal: %v", err)
}
return string(decoded)
}
@@ -258,7 +258,7 @@ func (s *scanner) scanInt(pos Pos) string {
return lit
}
}
- s.Error(pos, fmt.Sprintf("bad integer %q", lit))
+ s.Errorf(pos, "bad integer %q", lit)
return "0"
}
@@ -266,7 +266,7 @@ func (s *scanner) scanChar(pos Pos) string {
s.next()
s.next()
if s.ch != '\'' {
- s.Error(pos, "char literal is not terminated")
+ s.Errorf(pos, "char literal is not terminated")
return "0"
}
s.next()
@@ -288,7 +288,7 @@ func (s *scanner) scanIdent(pos Pos) (tok token, lit string) {
return
}
-func (s *scanner) Error(pos Pos, msg string, args ...interface{}) {
+func (s *scanner) Errorf(pos Pos, msg string, args ...interface{}) {
s.errors++
s.errorHandler(pos, fmt.Sprintf(msg, args...))
}
@@ -320,7 +320,7 @@ func (s *scanner) next() {
s.ch = s.data[s.off]
s.col++
if s.ch == 0 {
- s.Error(s.pos(), "illegal character \\x00")
+ s.Errorf(s.pos(), "illegal character \\x00")
}
}
diff --git a/pkg/bisect/bisect.go b/pkg/bisect/bisect.go
index 3f6c1ca07..339838039 100644
--- a/pkg/bisect/bisect.go
+++ b/pkg/bisect/bisect.go
@@ -191,33 +191,33 @@ func runImpl(cfg *Config, repo vcs.Repo, inst instance.Env) (*Result, error) {
if err != nil {
hostname = "unnamed host"
}
- env.log("%s starts bisection %s", hostname, env.startTime.String())
+ env.logf("%s starts bisection %s", hostname, env.startTime.String())
if cfg.Fix {
- env.log("bisecting fixing commit since %v", cfg.Kernel.Commit)
+ env.logf("bisecting fixing commit since %v", cfg.Kernel.Commit)
} else {
- env.log("bisecting cause commit starting from %v", cfg.Kernel.Commit)
+ env.logf("bisecting cause commit starting from %v", cfg.Kernel.Commit)
}
start := time.Now()
res, err := env.bisect()
if env.flaky {
- env.log("reproducer is flaky (%.2f repro chance estimate)", env.reproChance)
+ env.logf("reproducer is flaky (%.2f repro chance estimate)", env.reproChance)
}
- env.log("revisions tested: %v, total time: %v (build: %v, test: %v)",
+ env.logf("revisions tested: %v, total time: %v (build: %v, test: %v)",
env.numTests, time.Since(start), env.buildTime, env.testTime)
if err != nil {
- env.log("error: %v", err)
+ env.logf("error: %v", err)
return nil, err
}
if len(res.Commits) == 0 {
if cfg.Fix {
- env.log("crash still not fixed or there were kernel test errors")
+ env.logf("crash still not fixed or there were kernel test errors")
} else {
- env.log("oldest tested release already had the bug or it had kernel test errors")
+ env.logf("oldest tested release already had the bug or it had kernel test errors")
}
- env.log("commit msg: %v", res.Commit.Title)
+ env.logf("commit msg: %v", res.Commit.Title)
if res.Report != nil {
- env.log("crash: %v\n%s", res.Report.Title, res.Report.Report)
+ env.logf("crash: %v\n%s", res.Report.Title, res.Report.Report)
}
return res, nil
}
@@ -226,18 +226,18 @@ func runImpl(cfg *Config, repo vcs.Repo, inst instance.Env) (*Result, error) {
what = "good"
}
if len(res.Commits) > 1 {
- env.log("bisection is inconclusive, the first %v commit could be any of:", what)
+ env.logf("bisection is inconclusive, the first %v commit could be any of:", what)
for _, com := range res.Commits {
- env.log("%v", com.Hash)
+ env.logf("%v", com.Hash)
}
return res, nil
}
com := res.Commits[0]
- env.log("first %v commit: %v %v", what, com.Hash, com.Title)
- env.log("recipients (to): %q", com.Recipients.GetEmails(vcs.To))
- env.log("recipients (cc): %q", com.Recipients.GetEmails(vcs.Cc))
+ env.logf("first %v commit: %v %v", what, com.Hash, com.Title)
+ env.logf("recipients (to): %q", com.Recipients.GetEmails(vcs.To))
+ env.logf("recipients (cc): %q", com.Recipients.GetEmails(vcs.Cc))
if res.Report != nil {
- env.log("crash: %v\n%s", res.Report.Title, res.Report.Report)
+ env.logf("crash: %v\n%s", res.Report.Title, res.Report.Report)
}
return res, nil
}
@@ -253,7 +253,7 @@ func (env *env) bisect() (*Result, error) {
cfg.Manager.Type, cfg.Manager.KernelSrc); err != nil {
return nil, fmt.Errorf("kernel clean failed: %w", err)
}
- env.log("building syzkaller on %v", cfg.Syzkaller.Commit)
+ env.logf("building syzkaller on %v", cfg.Syzkaller.Commit)
if _, err := env.inst.BuildSyzkaller(cfg.Syzkaller.Repo, cfg.Syzkaller.Commit); err != nil {
return nil, err
}
@@ -267,7 +267,7 @@ func (env *env) bisect() (*Result, error) {
return nil, err
}
- env.log("ensuring issue is reproducible on original commit %v\n", cfg.Kernel.Commit)
+ env.logf("ensuring issue is reproducible on original commit %v\n", cfg.Kernel.Commit)
env.commit = com
env.kernelConfig = cfg.Kernel.Config
testRes, err := env.test()
@@ -308,7 +308,7 @@ func (env *env) bisect() (*Result, error) {
if err != nil {
return nil, err
}
- env.log("accumulated error probability: %0.2f", 1.0-env.confidence)
+ env.logf("accumulated error probability: %0.2f", 1.0-env.confidence)
res := &Result{
Commits: commits,
Config: env.kernelConfig,
@@ -323,12 +323,12 @@ func (env *env) bisect() (*Result, error) {
res.Report = testRes.rep
isRelease, err := env.bisecter.IsRelease(com.Hash)
if err != nil {
- env.log("failed to detect release: %v", err)
+ env.logf("failed to detect release: %v", err)
}
res.IsRelease = isRelease
noopChange, err := env.detectNoopChange(com)
if err != nil {
- env.log("failed to detect noop change: %v", err)
+ env.logf("failed to detect noop change: %v", err)
}
res.NoopChange = noopChange
}
@@ -355,12 +355,12 @@ func (env *env) identifyRewrittenCommit() (string, error) {
// reachable from cfg.Kernel.Branch.
// So let's try to force tag fetch and check if the commit is present in the
// repository.
- env.log("fetch other tags and check if the commit is present")
+ env.logf("fetch other tags and check if the commit is present")
commit, err := env.repo.CheckoutCommit(cfg.Kernel.Repo, cfg.Kernel.Commit)
if err != nil {
// Ignore the error because the command will fail if the commit is really not
// present in the tree.
- env.log("fetch failed with %s", err)
+ env.logf("fetch failed with %s", err)
} else if commit != nil {
return commit.Hash, nil
}
@@ -387,7 +387,7 @@ func (env *env) identifyRewrittenCommit() (string, error) {
return cfg.Kernel.Commit, fmt.Errorf(
"commit %v not reachable in branch '%v'", cfg.Kernel.Commit, cfg.Kernel.Branch)
}
- env.log("rewritten commit %v reidentified by title '%v'\n", commit.Hash, cfg.Kernel.CommitTitle)
+ env.logf("rewritten commit %v reidentified by title '%v'\n", commit.Hash, cfg.Kernel.CommitTitle)
return commit.Hash, nil
}
@@ -418,7 +418,7 @@ func (env *env) minimizeConfig() (*testResult, error) {
env.cfg.Kernel.BaselineConfig, env.reportTypes, env.cfg.Trace, predMinimize)
if err != nil {
if errors.Is(err, vcs.ErrBadKconfig) {
- env.log("config minimization failed due to bad Kconfig %v\nproceeding with the original config", err)
+ env.logf("config minimization failed due to bad Kconfig %v\nproceeding with the original config", err)
} else {
return nil, err
}
@@ -435,7 +435,7 @@ func (env *env) detectNoopChange(com *vcs.Commit) (bool, error) {
parent := com.Parents[0]
parentRes := env.results[parent]
if parentRes == nil {
- env.log("parent commit %v wasn't tested", parent)
+ env.logf("parent commit %v wasn't tested", parent)
// We could not test the parent commit if it is not based on the previous release
// (instead based on an older release, i.e. a very old non-rebased commit
// merged into the current release).
@@ -451,8 +451,8 @@ func (env *env) detectNoopChange(com *vcs.Commit) (bool, error) {
}
parentRes = &testResult{kernelSign: kernelSign}
}
- env.log("culprit signature: %v", testRes.kernelSign)
- env.log("parent signature: %v", parentRes.kernelSign)
+ env.logf("culprit signature: %v", testRes.kernelSign)
+ env.logf("parent signature: %v", parentRes.kernelSign)
return testRes.kernelSign == parentRes.kernelSign, nil
}
@@ -475,17 +475,17 @@ func (env *env) commitRangeForFix() (*vcs.Commit, *vcs.Commit, []*testResult, er
var results []*testResult
startCommit := env.commit
if env.cfg.CrossTree {
- env.log("determining the merge base between %v and %v",
+ env.logf("determining the merge base between %v and %v",
env.commit.Hash, env.head.Hash)
bases, err := env.repo.MergeBases(env.commit.Hash, env.head.Hash)
if err != nil {
return nil, nil, nil, err
}
if len(bases) != 1 {
- env.log("expected 1 merge base, got %d", len(bases))
+ env.logf("expected 1 merge base, got %d", len(bases))
return nil, nil, nil, fmt.Errorf("expected 1 merge base, got %d", len(bases))
}
- env.log("%s/%s is a merge base, check if it has the bug", bases[0].Hash, bases[0].Title)
+ env.logf("%s/%s is a merge base, check if it has the bug", bases[0].Hash, bases[0].Title)
startCommit = bases[0]
if _, err := env.repo.SwitchCommit(startCommit.Hash); err != nil {
return nil, nil, nil, err
@@ -499,7 +499,7 @@ func (env *env) commitRangeForFix() (*vcs.Commit, *vcs.Commit, []*testResult, er
return nil, startCommit, results, nil
}
}
- env.log("testing current HEAD %v", env.head.Hash)
+ env.logf("testing current HEAD %v", env.head.Hash)
if _, err := env.repo.SwitchCommit(env.head.Hash); err != nil {
return nil, nil, nil, err
}
@@ -524,12 +524,12 @@ func (env *env) commitRangeForCause() (*vcs.Commit, *vcs.Commit, []*testResult,
return nil, nil, nil, fmt.Errorf("no release tags before this commit")
}
pickedTags := pickReleaseTags(tags)
- env.log("picked %v out of %d release tags", pickedTags, len(tags))
+ env.logf("picked %v out of %d release tags", pickedTags, len(tags))
lastBad := env.commit
var results []*testResult
for _, tag := range pickedTags {
- env.log("testing release %v", tag)
+ env.logf("testing release %v", tag)
com, err := env.repo.SwitchCommit(tag)
if err != nil {
return nil, nil, nil, err
@@ -558,7 +558,7 @@ func (env *env) validateCommitRange(bad, good *vcs.Commit, results []*testResult
if env.cfg.Fix && env.cfg.CrossTree && len(results) < 2 {
// For cross-tree bisections, it can be the case that the bug was introduced
// after the merge base, so there's no sense to continue the fix bisection.
- env.log("reproducer does not crash the merge base, so there's no known bad commit")
+ env.logf("reproducer does not crash the merge base, so there's no known bad commit")
return &Result{Commit: good, Config: env.kernelConfig}, nil
}
@@ -567,14 +567,14 @@ func (env *env) validateCommitRange(bad, good *vcs.Commit, results []*testResult
// For cause bisection: Oldest tested release already had the bug. Giving up.
// For fix bisection: Crash still not fixed on HEAD. Leaving Result.Commits empty causes
// syzbot to retry this bisection later.
- env.log("crash still not fixed/happens on the oldest tested release")
+ env.logf("crash still not fixed/happens on the oldest tested release")
return &Result{Report: finalResult.rep, Commit: bad, Config: env.kernelConfig}, nil
}
if finalResult.verdict == vcs.BisectSkip {
if env.cfg.Fix {
// HEAD is moving target. Sometimes changes break syzkaller fuzzing.
// Leaving Result.Commits empty so syzbot retries this bisection again later.
- env.log("HEAD had kernel build, boot or test errors")
+ env.logf("HEAD had kernel build, boot or test errors")
return &Result{Report: finalResult.rep, Commit: bad, Config: env.kernelConfig}, nil
}
// The oldest tested release usually doesn't change. Retrying would give us the same result,
@@ -611,7 +611,7 @@ func (env *env) build() (*vcs.Commit, string, error) {
if err != nil {
return current, "", err
}
- env.log("testing commit %v %v", current.Hash, env.cfg.CompilerType)
+ env.logf("testing commit %v %v", current.Hash, env.cfg.CompilerType)
buildStart := time.Now()
mgr := env.cfg.Manager
if err := build.Clean(mgr.TargetOS, mgr.TargetVMArch, mgr.Type, mgr.KernelSrc); err != nil {
@@ -629,10 +629,10 @@ func (env *env) build() (*vcs.Commit, string, error) {
BuildCPUs: env.cfg.BuildCPUs,
})
if imageDetails.CompilerID != "" {
- env.log("compiler: %v", imageDetails.CompilerID)
+ env.logf("compiler: %v", imageDetails.CompilerID)
}
if imageDetails.Signature != "" {
- env.log("kernel signature: %v", imageDetails.Signature)
+ env.logf("kernel signature: %v", imageDetails.Signature)
}
env.buildTime += time.Since(buildStart)
return current, imageDetails.Signature, err
@@ -669,10 +669,10 @@ func (env *env) test() (*testResult, error) {
env.saveDebugFile(current.Hash, 0, kerr.Output)
} else {
errInfo += err.Error()
- env.log("%v", err)
+ env.logf("%v", err)
}
- env.log("%s", errInfo)
+ env.logf("%s", errInfo)
res.rep = &report.Report{Title: errInfo}
return res, nil
}
@@ -705,7 +705,7 @@ func (env *env) test() (*testResult, error) {
if res.verdict == vcs.BisectGood {
// The result could be a false negative.
res.confidence = 1.0 - math.Pow(1.0-env.reproChance, float64(good))
- env.log("false negative chance: %.3f", 1.0-res.confidence)
+ env.logf("false negative chance: %.3f", 1.0-res.confidence)
}
if res.verdict == vcs.BisectSkip {
res.rep = &report.Report{
@@ -728,7 +728,7 @@ func (env *env) testPredicate() (vcs.BisectResult, error) {
if env.cfg.Fix {
// There's a chance we might test a revision that does not yet contain the bug.
// Perform extra checks (see #4117).
- env.log("determine whether the revision contains the guilty commit")
+ env.logf("determine whether the revision contains the guilty commit")
hadBug, err := env.revisionHadBug()
if err == errUnknownBugPresence {
// Let's skip the revision just in case.
@@ -738,7 +738,7 @@ func (env *env) testPredicate() (vcs.BisectResult, error) {
}
if !hadBug {
// For result consistency, pretend that the kernel crashed.
- env.log("the bug was not introduced yet; pretend that kernel crashed")
+ env.logf("the bug was not introduced yet; pretend that kernel crashed")
testRes1 = &testResult{verdict: vcs.BisectBad}
}
}
@@ -777,7 +777,7 @@ func (env *env) revisionHadBug() (bool, error) {
return false, err
}
if ok {
- env.log("revision %s crashed and is reachable", hash)
+ env.logf("revision %s crashed and is reachable", hash)
return true, nil
}
}
@@ -802,10 +802,10 @@ func (env *env) revisionHadBug() (bool, error) {
}
anyResult := false
for _, base := range bases {
- env.log("checking the merge base %s", base.Hash)
+ env.logf("checking the merge base %s", base.Hash)
res := env.results[base.Hash]
if res == nil {
- env.log("no existing result, test the revision")
+ env.logf("no existing result, test the revision")
env.repo.SwitchCommit(base.Hash)
res, err = env.test()
if err != nil {
@@ -853,7 +853,7 @@ func (env *env) bisectionDecision(total, bad, good, infra int) (vcs.BisectResult
return vcs.BisectSkip,
&InfraError{Title: "unable to determine the verdict because of infra errors"}
}
- env.log("unable to determine the verdict: %d good runs (wanted %d), for bad wanted %d in total, got %d",
+ env.logf("unable to determine the verdict: %d good runs (wanted %d), for bad wanted %d in total, got %d",
good, wantGoodRuns, wantTotalRuns, good+bad)
return vcs.BisectSkip, nil
}
@@ -908,10 +908,10 @@ func (env *env) processResults(current *vcs.Commit, results []instance.EnvTestRe
unique[verdict] = true
}
if len(unique) == 1 {
- env.log("all runs: %v", verdicts[0])
+ env.logf("all runs: %v", verdicts[0])
} else {
for i, verdict := range verdicts {
- env.log("run #%v: %v", i, verdict)
+ env.logf("run #%v: %v", i, verdict)
}
}
var others bool
@@ -919,7 +919,7 @@ func (env *env) processResults(current *vcs.Commit, results []instance.EnvTestRe
if rep != nil || others {
// TODO: set flaky=true or in some other way indicate that the bug
// triggers multiple different crashes?
- env.log("representative crash: %v, types: %v", rep.Title, types)
+ env.logf("representative crash: %v, types: %v", rep.Title, types)
}
return
}
@@ -1041,7 +1041,11 @@ func checkConfig(cfg *Config) error {
return nil
}
-func (env *env) log(msg string, args ...interface{}) {
+func (env *env) log(msg string) {
+ env.logf("%v", msg)
+}
+
+func (env *env) logf(msg string, args ...interface{}) {
if false {
_ = fmt.Sprintf(msg, args...) // enable printf checker
}
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go
index 3bda9cfe6..87da67c39 100644
--- a/pkg/compiler/check.go
+++ b/pkg/compiler/check.go
@@ -782,7 +782,7 @@ func (comp *compiler) collectUsedType(structs, flags, strflags map[string]bool,
func (comp *compiler) checkUnused() {
for _, n := range comp.collectUnused() {
pos, typ, name := n.Info()
- comp.error(pos, fmt.Sprintf("unused %v %v", typ, name))
+ comp.error(pos, "unused %v %v", typ, name)
}
}
diff --git a/pkg/log/log.go b/pkg/log/log.go
index 216f00a6a..bcb4dbda8 100644
--- a/pkg/log/log.go
+++ b/pkg/log/log.go
@@ -75,6 +75,10 @@ func V(level int) bool {
return level <= *flagV
}
+func Log(v int, msg string) {
+ Logf(v, "%v", msg)
+}
+
func Logf(v int, msg string, args ...interface{}) {
writeMessage(v, "", msg, args...)
}
@@ -92,7 +96,7 @@ func Fatal(err error) {
}
func Fatalf(msg string, args ...interface{}) {
- golog.Fatalf(message("FATAL", msg, args...))
+ golog.Fatal(message("FATAL", msg, args...))
}
// SyzFatalf-reported errors are parsed by syzkaller as if they were kernel bugs.
diff --git a/pkg/log/log_test.go b/pkg/log/log_test.go
index c1be24a9f..c63d453f9 100644
--- a/pkg/log/log_test.go
+++ b/pkg/log/log_test.go
@@ -26,7 +26,7 @@ func TestCaching(t *testing.T) {
}
prependTime = false
for _, test := range tests {
- Logf(1, test.str)
+ Log(1, test.str)
out := CachedLogOutput()
if out != test.want {
t.Fatalf("wrote: %v\nwant: %v\ngot: %v", test.str, test.want, out)
diff --git a/pkg/runtest/run_test.go b/pkg/runtest/run_test.go
index 80f7308db..219e84046 100644
--- a/pkg/runtest/run_test.go
+++ b/pkg/runtest/run_test.go
@@ -79,7 +79,7 @@ func test(t *testing.T, sysTarget *targets.Target) {
EnabledCalls: enabledCalls,
LogFunc: func(text string) {
t.Helper()
- t.Logf(text)
+ t.Log(text)
},
Retries: 7, // empirical number that seem to reduce flakes to zero
Verbose: true,
diff --git a/prog/encoding.go b/prog/encoding.go
index af0bccfc0..b614e247e 100644
--- a/prog/encoding.go
+++ b/prog/encoding.go
@@ -56,6 +56,10 @@ type serializer struct {
verbose bool
}
+func (ctx *serializer) print(text string) {
+ ctx.printf("%v", text)
+}
+
func (ctx *serializer) printf(text string, args ...interface{}) {
fmt.Fprintf(ctx.buf, text, args...)
}
@@ -81,7 +85,7 @@ func (ctx *serializer) call(c *Call) {
}
ctx.arg(a)
}
- ctx.printf(")")
+ ctx.print(")")
anyChangedProps := false
c.Props.ForeachProp(func(name, key string, value reflect.Value) {
@@ -91,13 +95,13 @@ func (ctx *serializer) call(c *Call) {
}
if !anyChangedProps {
- ctx.printf(" (")
+ ctx.print(" (")
anyChangedProps = true
} else {
- ctx.printf(", ")
+ ctx.print(", ")
}
- ctx.printf(key)
+ ctx.print(key)
switch kind := value.Kind(); kind {
case reflect.Int:
ctx.printf(": %d", value.Int())
diff --git a/prog/hints_test.go b/prog/hints_test.go
index 44c24bfb8..ad525b71b 100644
--- a/prog/hints_test.go
+++ b/prog/hints_test.go
@@ -319,7 +319,7 @@ func TestHintsCheckDataArg(t *testing.T) {
s += fmt.Sprintf("0x%x, ", x)
}
s += "]\n"
- t.Fatalf(s)
+ t.Fatal(s)
}
})
}
diff --git a/prog/prio.go b/prog/prio.go
index ca4e11de4..142ad36b4 100644
--- a/prog/prio.go
+++ b/prog/prio.go
@@ -84,7 +84,7 @@ func (target *Target) calcResourceUsage() map[string]map[int]weights {
switch a := t.(type) {
case *ResourceType:
if target.AuxResources[a.Desc.Name] {
- noteUsage(uses, c, 1, ctx.Dir, "res%v", a.Desc.Name)
+ noteUsagef(uses, c, 1, ctx.Dir, "res%v", a.Desc.Name)
} else {
str := "res"
for i, k := range a.Desc.Kind {
@@ -98,20 +98,20 @@ func (target *Target) calcResourceUsage() map[string]map[int]weights {
}
case *PtrType:
if _, ok := a.Elem.(*StructType); ok {
- noteUsage(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name())
+ noteUsagef(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name())
}
if _, ok := a.Elem.(*UnionType); ok {
- noteUsage(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name())
+ noteUsagef(uses, c, 10, ctx.Dir, "ptrto-%v", a.Elem.Name())
}
if arr, ok := a.Elem.(*ArrayType); ok {
- noteUsage(uses, c, 10, ctx.Dir, "ptrto-%v", arr.Elem.Name())
+ noteUsagef(uses, c, 10, ctx.Dir, "ptrto-%v", arr.Elem.Name())
}
case *BufferType:
switch a.Kind {
case BufferBlobRand, BufferBlobRange, BufferText, BufferCompressed:
case BufferString, BufferGlob:
if a.SubKind != "" {
- noteUsage(uses, c, 2, ctx.Dir, fmt.Sprintf("str-%v", a.SubKind))
+ noteUsagef(uses, c, 2, ctx.Dir, "str-%v", a.SubKind)
}
case BufferFilename:
noteUsage(uses, c, 10, DirIn, "filename")
@@ -137,7 +137,11 @@ type weights struct {
inout int32
}
-func noteUsage(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string, args ...interface{}) {
+func noteUsage(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string) {
+ noteUsagef(uses, c, weight, dir, "%v", str)
+}
+
+func noteUsagef(uses map[string]map[int]weights, c *Syscall, weight int32, dir Dir, str string, args ...interface{}) {
id := fmt.Sprintf(str, args...)
if uses[id] == nil {
uses[id] = make(map[int]weights)
diff --git a/vm/starnix/starnix.go b/vm/starnix/starnix.go
index f722badcf..8050760d0 100644
--- a/vm/starnix/starnix.go
+++ b/vm/starnix/starnix.go
@@ -283,7 +283,7 @@ func (inst *instance) connect() error {
return err
}
if inst.debug {
- log.Logf(0, fmt.Sprintf("instance %s: the fuchsia instance's address is %s", inst.name, address))
+ log.Logf(0, "instance %s: the fuchsia instance's address is %s", inst.name, address)
}
cmd := osutil.Command(
"ssh",