Skip to content

Commit

Permalink
refactor: reuse OptLevel() to get the opt level
Browse files Browse the repository at this point in the history
  • Loading branch information
radkomih committed Nov 20, 2023
1 parent d4189fe commit 7c89676
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,21 +807,8 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe

// Run wasm-opt for wasm binaries
if arch := strings.Split(config.Triple(), "-")[0]; arch == "wasm32" {
var opt string
switch config.Options.Opt {
case "none", "0":
opt = "-O0"
case "1":
opt = "-O1"
case "2":
opt = "-O2"
case "s":
opt = "-Os"
case "z":
opt = "-Oz"
default:
return fmt.Errorf("unknown opt level: %q", config.Options.Opt)
}
optLevel, _, _ := config.OptLevel()
opt := "-" + optLevel

var args []string

Expand Down

0 comments on commit 7c89676

Please sign in to comment.