From cdead3722d55f83c436af95a3217791e1cee4ecf Mon Sep 17 00:00:00 2001 From: Matt Mets Date: Thu, 2 Jan 2025 18:41:16 +0100 Subject: [PATCH 1/3] Fix for #4678: top-level 'make lint' wasn't working The revive command seems to have had a syntax error in the file input glob. It appears to have been broken in a way that did not result in a return code being set. This change uses 'find' to build the input to the linter. Note that it is expected to fail the CI script, because it is uncovering some existing lint issues that were not being caught. --- GNUmakefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 99dc3913b6..d4b1d3d4c4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1098,6 +1098,7 @@ endif tools: cd internal/tools && go generate -tags tools ./ +LINTFILESCMD=find src/os/ src/reflect/ -type f -name '*.go' .PHONY: lint lint: tools ## Lint source tree revive -version @@ -1105,7 +1106,10 @@ lint: tools ## Lint source tree # revive.toml isn't flexible enough to filter out just one kind of error from a checker, so do it with grep here. # Can't use grep with friendly formatter. Plain output isn't too bad, though. # Use 'grep .' to get rid of stray blank line - revive -config revive.toml compiler/... src/{os,reflect}/*.go | grep -v "should have comment or be unexported" | grep '.' | awk '{print}; END {exit NR>0}' + revive -config revive.toml compiler/... $$( $(LINTFILESCMD) ) \ + | grep -v "should have comment or be unexported" \ + | grep '.' \ + | awk '{print}; END {exit NR>0}' SPELLDIRSCMD=find . -depth 1 -type d | egrep -wv '.git|lib|llvm|src'; find src -depth 1 | egrep -wv 'device|internal|net|vendor'; find src/internal -depth 1 -type d | egrep -wv src/internal/wasi .PHONY: spell From a29a2e39cb116b5f776da70c1b251f20d22159ea Mon Sep 17 00:00:00 2001 From: Matt Mets Date: Mon, 6 Jan 2025 11:07:40 +0100 Subject: [PATCH 2/3] Move the directory list into a variable --- GNUmakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index d4b1d3d4c4..148ffdc4d4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1098,7 +1098,7 @@ endif tools: cd internal/tools && go generate -tags tools ./ -LINTFILESCMD=find src/os/ src/reflect/ -type f -name '*.go' +LINTDIRS=src/os/ src/reflect/ .PHONY: lint lint: tools ## Lint source tree revive -version @@ -1106,7 +1106,7 @@ lint: tools ## Lint source tree # revive.toml isn't flexible enough to filter out just one kind of error from a checker, so do it with grep here. # Can't use grep with friendly formatter. Plain output isn't too bad, though. # Use 'grep .' to get rid of stray blank line - revive -config revive.toml compiler/... $$( $(LINTFILESCMD) ) \ + revive -config revive.toml compiler/... $$( find $(LINTDIRS) -type f -name '*.go' ) \ | grep -v "should have comment or be unexported" \ | grep '.' \ | awk '{print}; END {exit NR>0}' From 501052b7e129867f95f3f4b8e8b856a53366a361 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Sat, 16 Aug 2025 17:01:21 +0200 Subject: [PATCH 3/3] fix: correct linter issues exposed by the fix in #4679 Signed-off-by: deadprogram --- compiler/llvmutil/llvm.go | 2 +- src/os/file_unix.go | 1 - src/reflect/value.go | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/llvmutil/llvm.go b/compiler/llvmutil/llvm.go index 061bee6c9a..9295c44094 100644 --- a/compiler/llvmutil/llvm.go +++ b/compiler/llvmutil/llvm.go @@ -218,7 +218,7 @@ func Version() int { return major } -// Return the byte order for the given target triple. Most targets are little +// ByteOrder returns the byte order for the given target triple. Most targets are little // endian, but for example MIPS can be big-endian. func ByteOrder(target string) binary.ByteOrder { if strings.HasPrefix(target, "mips-") { diff --git a/src/os/file_unix.go b/src/os/file_unix.go index 9dc3a91e09..17d26e166b 100644 --- a/src/os/file_unix.go +++ b/src/os/file_unix.go @@ -12,7 +12,6 @@ package os import ( "io" "syscall" - _ "unsafe" ) const DevNull = "/dev/null" diff --git a/src/reflect/value.go b/src/reflect/value.go index cf186c2ce1..a7e4787c67 100644 --- a/src/reflect/value.go +++ b/src/reflect/value.go @@ -81,8 +81,8 @@ func (it *MapIter) Next() bool { return ((*reflectlite.MapIter)(it)).Next() } -func (iter *MapIter) Reset(v Value) { - (*reflectlite.MapIter)(iter).Reset(v.Value) +func (it *MapIter) Reset(v Value) { + (*reflectlite.MapIter)(it).Reset(v.Value) } func (v Value) Set(x Value) {