Skip to content

Commit 1808923

Browse files
committed
Add gcflags to disable optimization
1 parent caeca06 commit 1808923

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

magefiles/magefile.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,10 @@ func build(debug bool) error {
401401
}
402402

403403
execName := "trivy"
404+
gcflags := ""
404405
if debug {
405406
execName = "trivy-debug"
407+
gcflags = "-gcflags=all=-N -l"
406408
}
407409

408410
ldflags, err := buildLdflags(debug)
@@ -414,7 +416,7 @@ func build(debug bool) error {
414416
return err
415417
}
416418
return sh.RunWith(ENV, "go", "build", "-o", execName, "-ldflags", ldflags,
417-
filepath.Join(wd, "cmd", "trivy"))
419+
gcflags, filepath.Join(wd, "cmd", "trivy"))
418420
}
419421

420422
// Install installs Trivy

0 commit comments

Comments
 (0)