From 88dff592eec58d7c708ef1ac20cf50ee25eb6785 Mon Sep 17 00:00:00 2001 From: Max-Cheng Date: Sun, 11 Feb 2024 11:22:23 +0800 Subject: [PATCH] Change empty string checks to be more idiomatic (#1684) --- fs.go | 2 +- header_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs.go b/fs.go index 02a6af07ad..0cfb08ec02 100644 --- a/fs.go +++ b/fs.go @@ -461,7 +461,7 @@ func (fs *FS) initRequestHandler() { } compressedFileSuffixes := fs.CompressedFileSuffixes - if len(compressedFileSuffixes["br"]) == 0 || len(compressedFileSuffixes["gzip"]) == 0 || + if compressedFileSuffixes["br"] == "" || compressedFileSuffixes["gzip"] == "" || len(compressedFileSuffixes["zstd"]) == 0 || compressedFileSuffixes["br"] == compressedFileSuffixes["gzip"] || compressedFileSuffixes["br"] == compressedFileSuffixes["zstd"] || compressedFileSuffixes["gzip"] == compressedFileSuffixes["zstd"] { diff --git a/header_test.go b/header_test.go index af162e59d9..163fdd7b75 100644 --- a/header_test.go +++ b/header_test.go @@ -2335,7 +2335,7 @@ type bufioPeekReader struct { } func (r *bufioPeekReader) Read(b []byte) (int, error) { - if len(r.s) == 0 { + if r.s == "" { return 0, io.EOF }