diff --git a/builder/build.go b/builder/build.go index 8b9e9e81..a5fd84b4 100644 --- a/builder/build.go +++ b/builder/build.go @@ -476,6 +476,9 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil } ldflags = append(ldflags, dependency.result) } + if config.Options.PrintCommands { + fmt.Printf("%s %s\n", config.Target.Linker, strings.Join(ldflags, " ")) + } err = link(config.Target.Linker, ldflags...) if err != nil { return &commandError{"failed to link", executable, err} diff --git a/builder/cc.go b/builder/cc.go index 89dd7ca5..3f78ce00 100644 --- a/builder/cc.go +++ b/builder/cc.go @@ -124,6 +124,9 @@ func compileAndCacheCFile(abspath, tmpdir string, config *compileopts.Config) (s flags := config.CFlags() flags = append(flags, "-MD", "-MV", "-MTdeps", "-MF", depTmpFile.Name()) // autogenerate dependencies flags = append(flags, "-c", "-o", objTmpFile.Name(), abspath) + if config.Options.PrintCommands { + fmt.Printf("%s %s\n", config.Target.Compiler, strings.Join(flags, " ")) + } err = runCCompiler(config.Target.Compiler, flags...) if err != nil { return "", &commandError{"failed to build", abspath, err} diff --git a/main.go b/main.go index e095d216..f8b9a327 100644 --- a/main.go +++ b/main.go @@ -93,7 +93,7 @@ func copyFile(src, dst string) error { // executeCommand is a simple wrapper to exec.Cmd func executeCommand(options *compileopts.Options, name string, arg ...string) *exec.Cmd { if options.PrintCommands { - fmt.Printf("%s %s\n ", name, strings.Join(arg, " ")) + fmt.Printf("%s %s\n", name, strings.Join(arg, " ")) } return exec.Command(name, arg...) }