From a4ff143cc5dc473a7ab8babc33ce2672b2f3d9f7 Mon Sep 17 00:00:00 2001 From: Niels Widger Date: Fri, 19 Dec 2025 15:03:16 -0500 Subject: [PATCH] Fix behavior of `hujsonfmt -l` The usage of `hujsonfmt` says that `hujsonfmt -l` only list files whose formatting differs from `hujsonfmt`'s, but the current behavior seems to list all files regardless of their formatting. This PR attempts to fix that! --- cmd/hujsonfmt/hujsonfmt.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/hujsonfmt/hujsonfmt.go b/cmd/hujsonfmt/hujsonfmt.go index b73fb11..16e2e73 100644 --- a/cmd/hujsonfmt/hujsonfmt.go +++ b/cmd/hujsonfmt/hujsonfmt.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "flag" "fmt" "io" @@ -118,7 +119,9 @@ func processFile(info fs.FileInfo, filename string, in io.Reader) error { case *diff: printDiff(filename, src, output) case *list: - fmt.Println(filename) + if !bytes.Equal(input, output) { + fmt.Println(filename) + } case *write: err = writeFile(info, filename, src, output) if err != nil {