Fix new lint issues reported by golangci-lint v1.59.0

Error return value of `fmt.Fprintf` is not checked (errcheck)
This commit is contained in:
albertony 2024-05-31 09:27:57 +02:00
parent 2257c03391
commit 3f3e4b055e
2 changed files with 4 additions and 3 deletions

View File

@ -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, `<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
_, err := fmt.Fprintf(w, `<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
<d:response>
<d:href>/remote.php/webdav/</d:href>
<d:propstat>
@ -41,8 +41,8 @@ func prepareServer(t *testing.T) (configmap.Simple, func()) {
</d:propstat>
</d:response>
</d:multistatus>`)
require.NoError(t, err)
})
// Make the test server
ts := httptest.NewServer(handler)

View File

@ -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