remove module info from the resulting binary

pull/22/head
Daniel Martí 5 years ago
parent 33f2a4bc2e
commit 3f35fb07f2

@ -174,6 +174,9 @@ func transformCompile(args []string) ([]string, error) {
// log.Printf("%#v", ids)
var files []*ast.File
for _, path := range paths {
if strings.HasSuffix(path, "_gomod_.go") {
continue // don't include module info
}
file, err := parser.ParseFile(fset, path, nil, 0)
if err != nil {
return nil, err

@ -0,0 +1,26 @@
exec go build
exec ./main
cmp stdout main.stdout-orig
garble build
exec ./main
cmp stdout main.stdout
! grep '\(devel\)' main
-- go.mod --
module foo.com/main
-- main.go --
package main
import (
"fmt"
"runtime/debug"
)
func main() {
fmt.Println(debug.ReadBuildInfo())
}
-- main.stdout-orig --
&{foo.com/main {foo.com/main (devel) <nil>} []} true
-- main.stdout --
<nil> false
Loading…
Cancel
Save