From f66bdbe2fe8d5507bf21457d81a864c67fff9a86 Mon Sep 17 00:00:00 2001 From: Ronald G Minnich Date: Wed, 22 Oct 2025 12:47:40 -0700 Subject: [PATCH 1/2] Enable verbose printing during go generate You can not pass flags directly, but export VM_VERBOSE=1 go generate will get your more output Signed-off-by: Ronald G Minnich --- vm/build.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vm/build.go b/vm/build.go index cb6d599..a3739ce 100644 --- a/vm/build.go +++ b/vm/build.go @@ -66,6 +66,8 @@ var builds = []build{ } func main() { + _, verbose := os.LookupEnv("VM_VERBOSE") + env := []string{"CGO_ENABLED=0"} for _, b := range builds { log.Printf("Build %v", b) @@ -130,7 +132,7 @@ func main() { if len(b.container) == 0 { continue } - if false { + if verbose { ref, err := name.ParseReference(b.container, name.Insecure) if err != nil { log.Fatal(err) @@ -138,7 +140,6 @@ func main() { fmt.Printf("parse %s to %s", b.container, ref.Name()) } - //img, err := crane.Pull(ref.Name()) img, err := crane.Pull(b.container) if err != nil { log.Fatal(err) From b2d3ff6bff4735ae64e365d3acc0d1bce35c675a Mon Sep 17 00:00:00 2001 From: Ronald G Minnich Date: Wed, 22 Oct 2025 13:00:11 -0700 Subject: [PATCH 2/2] control spew in TestIP with environment VMTEST_SPEW Signed-off-by: Ronald G Minnich --- vm/ip_linux_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vm/ip_linux_test.go b/vm/ip_linux_test.go index aecc973..912b0a6 100644 --- a/vm/ip_linux_test.go +++ b/vm/ip_linux_test.go @@ -42,6 +42,7 @@ func none(s string, t []string) bool { // TestIP tests creation and removal of addresses, tunnels, and // ARP entries with the u-root ip command. func TestIP(t *testing.T) { + _, spew := os.LookupEnv("VMTEST_SPEW") d := t.TempDir() for _, arch := range []string{"amd64", "arm", "arm64", "riscv64"} { i, err := vm.New("linux", arch) @@ -66,7 +67,7 @@ func TestIP(t *testing.T) { // For debug. It's been needed, but we do not want this spew in // CI logs, so leave it off. - if false { + if spew { c.Stdout, c.Stderr = os.Stdout, os.Stderr } if err := i.StartVM(c); err != nil { @@ -206,13 +207,13 @@ func TestIP(t *testing.T) { t.Errorf("CPUCommand: got %v, want nil", err) continue } - if false { + if spew { client.SetVerbose(t.Logf) } b, err := cpu.CombinedOutput() - if false { // Only enable this if you want to see console output/errors. + if spew { // Only enable this if you want to see console output/errors. t.Logf("%s %v", string(b), err) }