diff options
| author | Eng Zer Jun <engzerjun@gmail.com> | 2021-10-14 12:27:58 +0800 |
|---|---|---|
| committer | Eng Zer Jun <engzerjun@gmail.com> | 2021-10-14 12:27:58 +0800 |
| commit | a23bcbb7ecf93fcda35976f4f2fb42a67830e718 (patch) | |
| tree | 3227e82e51346dad8649a17e991c9cf561ef8071 /weed/server/filer_server_handlers_write_upload.go | |
| parent | 4cbd390fbe634e2370c36a61b1574e9d648c3cee (diff) | |
| download | seaweedfs-a23bcbb7ecf93fcda35976f4f2fb42a67830e718.tar.xz seaweedfs-a23bcbb7ecf93fcda35976f4f2fb42a67830e718.zip | |
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Diffstat (limited to 'weed/server/filer_server_handlers_write_upload.go')
| -rw-r--r-- | weed/server/filer_server_handlers_write_upload.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/weed/server/filer_server_handlers_write_upload.go b/weed/server/filer_server_handlers_write_upload.go index 196d7638e..a7716ef02 100644 --- a/weed/server/filer_server_handlers_write_upload.go +++ b/weed/server/filer_server_handlers_write_upload.go @@ -5,7 +5,6 @@ import ( "crypto/md5" "hash" "io" - "io/ioutil" "net/http" "sort" "strings" @@ -31,7 +30,7 @@ var bufPool = sync.Pool{ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Request, reader io.Reader, chunkSize int32, fileName, contentType string, contentLength int64, so *operation.StorageOption) (fileChunks []*filer_pb.FileChunk, md5Hash hash.Hash, chunkOffset int64, uploadErr error, smallContent []byte) { md5Hash = md5.New() - var partReader = ioutil.NopCloser(io.TeeReader(reader, md5Hash)) + var partReader = io.NopCloser(io.TeeReader(reader, md5Hash)) var wg sync.WaitGroup var bytesBufferCounter int64 @@ -57,7 +56,7 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque dataSize, err := bytesBuffer.ReadFrom(limitedReader) - // data, err := ioutil.ReadAll(limitedReader) + // data, err := io.ReadAll(limitedReader) if err != nil || dataSize == 0 { bufPool.Put(bytesBuffer) atomic.AddInt64(&bytesBufferCounter, -1) |
