diff --git a/examples/README.md b/examples/README.md index 5dd1207..7e69b70 100644 --- a/examples/README.md +++ b/examples/README.md @@ -20,3 +20,5 @@ Real output from `godebugdiff` with no flags, on Go 1.27.3, on shallow clones of | `rclone.txt` | github.com/rclone/rclone | `f0cb5dd` | MIT | To redo one: clone the project, check out the commit, run `go mod download`, then `go run ./plugin/scripts PATH` from this repo. The results depend on the toolchain you run. + +The shop output and `cobra.txt` were regenerated on 2026-11-15 with Go 1.27.4. The Cobra checkout remains at the commit listed above; other saved real-project outputs retain their original toolchain. diff --git a/examples/real/cobra.txt b/examples/real/cobra.txt index a5bf0f9..2ecc33c 100644 --- a/examples/real/cobra.txt +++ b/examples/real/cobra.txt @@ -1,4 +1,4 @@ -go 1.15 -> 1.27 in github.com/spf13/cobra (go1.27.3, 2 test binaries) +go 1.15 -> 1.27 in github.com/spf13/cobra (go1.27.4, 2 test binaries) 28 GODEBUG defaults change. 13 reach a package your test binaries import. @@ -12,12 +12,12 @@ panicnil 1 -> default Go 1.21, runtime Go 1.21 made it a run-time error to call panic with a nil interface value, controlled by the panicnil setting. https://go.dev/doc/godebug#go-121 -winreadlinkvolume 0 -> default Go 1.23, os +winreadlinkvolume 0 -> default Go 1.23, os (Windows only) imported by all 2 test binaries Go 1.23 changed os.Readlink and filepath.EvalSymlinks to avoid trying to normalize volumes to drive letters, which was not always even possible. https://go.dev/doc/godebug#go-123 -winsymlink 0 -> default Go 1.23, os +winsymlink 0 -> default Go 1.23, os (Windows only) imported by all 2 test binaries Go 1.23 changed the mode bits reported by os.Lstat and os.Stat for reparse points, which can be controlled with the winsymlink setting. https://go.dev/doc/godebug#go-123 diff --git a/examples/shop-1.21-to-1.24.txt b/examples/shop-1.21-to-1.24.txt index 3a307ad..d2d2242 100644 --- a/examples/shop-1.21-to-1.24.txt +++ b/examples/shop-1.21-to-1.24.txt @@ -1,4 +1,4 @@ -go 1.21 -> 1.24 in example.com/shop (go1.27.3, 2 binaries) +go 1.21 -> 1.24 in example.com/shop (go1.27.4, 2 binaries) 15 GODEBUG defaults change. 14 reach a package your binaries import. @@ -17,12 +17,12 @@ httpservecontentkeepheaders 1 -> default Go 1.23, net/http Go 1.23 changed net/http.ServeContent, net/http.ServeFile, and net/http.ServeFS to remove Cache-Control, Content-Encoding, Etag, and Last-Modified headers when serving an error. https://go.dev/doc/godebug#go-123 -winreadlinkvolume 0 -> default Go 1.23, os +winreadlinkvolume 0 -> default Go 1.23, os (Windows only) imported by all 2 binaries Go 1.23 changed os.Readlink and filepath.EvalSymlinks to avoid trying to normalize volumes to drive letters, which was not always even possible. https://go.dev/doc/godebug#go-123 -winsymlink 0 -> default Go 1.23, os +winsymlink 0 -> default Go 1.23, os (Windows only) imported by all 2 binaries Go 1.23 changed the mode bits reported by os.Lstat and os.Stat for reparse points, which can be controlled with the winsymlink setting. https://go.dev/doc/godebug#go-123 diff --git a/plugin/scripts/godebugdiff.go b/plugin/scripts/godebugdiff.go index be53eba..929d271 100644 --- a/plugin/scripts/godebugdiff.go +++ b/plugin/scripts/godebugdiff.go @@ -67,7 +67,7 @@ type Change struct { After string `json:"after"` ReachedBy []string `json:"reachedBy"` // binaries that import Package GoCommand bool `json:"goCommand"` // the setting controls the go command, not binaries - WindowsOnly bool `json:"windowsOnly,omitempty"` // name starts with win; Linux services can skip + WindowsOnly bool `json:"windowsOnly,omitempty"` // Windows-specific setting; relevance depends on the deployment platform Doc string `json:"doc,omitempty"` URL string `json:"url,omitempty"` } diff --git a/plugin/scripts/godebugdiff_test.go b/plugin/scripts/godebugdiff_test.go index bbb9a9c..6f7f870 100644 --- a/plugin/scripts/godebugdiff_test.go +++ b/plugin/scripts/godebugdiff_test.go @@ -273,3 +273,24 @@ func TestWindowsOnly(t *testing.T) { t.Fatalf("JSON missing windowsOnly: %s", enc) } } + +func TestCompareWindowsOnly(t *testing.T) { + before := []Binary{{ImportPath: "example.com/app", Godebug: parseGodebug("winreadlinkvolume=0,httpmuxgo121=1"), Deps: map[string]bool{"os": true, "net/http": true}}} + after := []Binary{{ImportPath: "example.com/app", Godebug: parseGodebug(""), Deps: map[string]bool{"os": true, "net/http": true}}} + table := map[string]Setting{ + "winreadlinkvolume": {Name: "winreadlinkvolume", Package: "os", Changed: 26, Old: "0"}, + "httpmuxgo121": {Name: "httpmuxgo121", Package: "net/http", Changed: 22, Old: "1"}, + } + changes, _ := compare(before, after, table, nil) + if len(changes) != 2 { + t.Fatalf("changes: %+v", changes) + } + for _, c := range changes { + if c.WindowsOnly != (c.Name == "winreadlinkvolume") { + t.Errorf("platform classification: %+v", c) + } + if !reflect.DeepEqual(c.ReachedBy, []string{"example.com/app"}) { + t.Errorf("reachedBy: %+v", c) + } + } +}