1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-21 06:33:11 +00:00

fix unhandled error in common_linux.go (#2056)

* fix unhandled errors

* fix unhandled error in cache package test

* omit variable type

* omit variable type

* rename variable because collide with the imported package name

* handle file error on closing

* fix unhandled in common_linux.go
This commit is contained in:
Amir Hossein 2022-08-28 21:15:56 +04:30 committed by GitHub
parent b86f79eca4
commit 506f0b21c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ package common
import (
"context"
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
@ -37,7 +38,12 @@ func NumProcs() (uint64, error) {
if err != nil {
return 0, err
}
defer f.Close()
defer func(f *os.File) {
err := f.Close()
if err != nil {
log.Fatalln(err)
}
}(f)
list, err := f.Readdirnames(-1)
if err != nil {