From 9060226892910eb1368bbbec5649a29da5ad086c Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Tue, 22 Oct 2024 06:23:54 +0100 Subject: [PATCH] Add comment to clarify non-f-functions on golang standard lib Signed-off-by: Benjamin Wang --- tools/.golangci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/.golangci.yaml b/tools/.golangci.yaml index f65faa50fda..6fb51e4d209 100644 --- a/tools/.golangci.yaml +++ b/tools/.golangci.yaml @@ -120,4 +120,9 @@ linters-settings: # please keep this alphabetized # there is no variable-length variables, i.e. require require.NoErrorf for both cases below: # require.NoErrorf(t, err, "whatever message") # require.NoErrorf(t, err, "whatever message: %v", v) + # + # Note from golang programming perspective, we still prefer non-f-functions (i.e. fmt.Print) + # to f-functions (i.e. fmt.Printf) when there is no variable-length parameters. It's accepted + # to always require f-functions for stretchr/testify, but not for golang standard lib. + # Also refer to https://github.com/etcd-io/etcd/pull/18741#issuecomment-2422395914 require-f-funcs: true