From 3f3e4b055e322ed6b8c8686cc20948244d884c21 Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Fri, 31 May 2024 09:27:57 +0200 Subject: [PATCH] Fix new lint issues reported by golangci-lint v1.59.0 Error return value of `fmt.Fprintf` is not checked (errcheck) --- backend/webdav/webdav_internal_test.go | 4 ++-- fs/config/configfile/configfile_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/webdav/webdav_internal_test.go b/backend/webdav/webdav_internal_test.go index 20dee468b..c2c2d1dfa 100644 --- a/backend/webdav/webdav_internal_test.go +++ b/backend/webdav/webdav_internal_test.go @@ -29,7 +29,7 @@ func prepareServer(t *testing.T) (configmap.Simple, func()) { what := fmt.Sprintf("%s %s: Header ", r.Method, r.URL.Path) assert.Equal(t, headers[1], r.Header.Get(headers[0]), what+headers[0]) assert.Equal(t, headers[3], r.Header.Get(headers[2]), what+headers[2]) - fmt.Fprintf(w, ` + _, err := fmt.Fprintf(w, ` /remote.php/webdav/ @@ -41,8 +41,8 @@ func prepareServer(t *testing.T) (configmap.Simple, func()) { `) + require.NoError(t, err) }) - // Make the test server ts := httptest.NewServer(handler) diff --git a/fs/config/configfile/configfile_test.go b/fs/config/configfile/configfile_test.go index 2c2ba7e27..8ec7cd518 100644 --- a/fs/config/configfile/configfile_test.go +++ b/fs/config/configfile/configfile_test.go @@ -190,7 +190,8 @@ func TestConfigFileReload(t *testing.T) { // Now write a new value on the end out, err := os.OpenFile(config.GetConfigPath(), os.O_APPEND|os.O_WRONLY, 0777) require.NoError(t, err) - fmt.Fprintln(out, "appended = what magic") + _, err = fmt.Fprintln(out, "appended = what magic") + require.NoError(t, err) require.NoError(t, out.Close()) // And check we magically reloaded it