fix unhandled errors and update code comments to help the IDEs (#2128)

* 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

* fix unhandled errors in helpers_test.go

* fix unhandled errors in listen_test.go

* remove unused parameter in emptyHandler method

* refactor path.go

* unhandled error in hooks test

* fix unhandled errors in app_test.go

* fix unhandled errors in ctx_test.go

*  fix unhandled errors in helpers_test.go

* revert app_test.go

* remove redundant parentheses and update comments

* update code comment for helping ide

* update code comment for helping ide

* fix unhandled error in app_test.go

* update code comments for helping IDEs

* fix unhandled errors in app_test.go

* update code comment for helping the IDEs
pull/2131/head
Amir Hossein 2022-09-28 15:56:20 +03:30 committed by GitHub
parent 4108d73fe0
commit 66d5b195c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -1343,7 +1343,10 @@ func Test_App_ReadTimeout(t *testing.T) {
conn, err := net.Dial(NetworkTCP4, "127.0.0.1:4004")
utils.AssertEqual(t, nil, err)
defer conn.Close()
defer func(conn net.Conn) {
err := conn.Close()
utils.AssertEqual(t, nil, err)
}(conn)
_, err = conn.Write([]byte("HEAD /read-timeout HTTP/1.1\r\n"))
utils.AssertEqual(t, nil, err)
@ -1375,7 +1378,10 @@ func Test_App_BadRequest(t *testing.T) {
time.Sleep(500 * time.Millisecond)
conn, err := net.Dial(NetworkTCP4, "127.0.0.1:4005")
utils.AssertEqual(t, nil, err)
defer conn.Close()
defer func(conn net.Conn) {
err := conn.Close()
utils.AssertEqual(t, nil, err)
}(conn)
_, err = conn.Write([]byte("BadRequest\r\n"))
utils.AssertEqual(t, nil, err)

View File

@ -7,7 +7,7 @@ import (
)
type (
// Conversion error exposes the internal schema.ConversionError for public use.
// ConversionError Conversion error exposes the internal schema.ConversionError for public use.
ConversionError = schema.ConversionError
// UnknownKeyError error exposes the internal schema.UnknownKeyError for public use.
UnknownKeyError = schema.UnknownKeyError