* ci: update golangci-lint configuration and lint settings
- Update golangci-lint to version 2
- Enable new linters and adjust existing ones
- Update lint settings across multiple test files
- Remove unused struct and variable checks
- Add new lint exclusions for generated code and specific directories
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* ci(github): update golangci-lint-action to v8 and lint version to v2.3.4
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* ci: downgrade golangci-lint to v2.1.6
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* ci(golangci): add gofumpt linter and fix related issues- Added gofumpt linter to .golangci.yml
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* test: ignore testifylint and gofumpt lints in specific test cases
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
* build(deps): remove golang.org/x/lint
- Remove golang.org/x/lint package from go.mod
- Update related dependencies in go.sum
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
* build(deps): downgrade golang.org/x/mod and golang.org/x/tools
- Downgrade golang.org/x/mod from v0.24.0 to v0.18.0
- Downgrade golang.org/x/tools from v0.33.0 to v.22.0
These changes are made to address compatibility issues with the current project setup.
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
---------
Signed-off-by: Flc <four_leaf_clover@foxmail.com>
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
* experimental support http3
* remove go1.14 and go1.15
* update quic-go package path
* only support go1.19+
* remove go19 support
* update gomod
* chore: refine CI configuration and dependencies
- Remove dynamic Go versioning in favor of pinning to major version `1`
- Update linter version from `v1.56.2` to `v1.58.1` in GitHub Actions workflow
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* chore: refactor CI workflow and improve tests
- Update the golangci-lint-action version from `v5` to `v6` in the GitHub workflow configuration
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* chore: update dependencies and CI configurations
- Update Go version requirement from `1.20` to `1.21` in `go.mod`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* style: refactor codebase and update tests
- Add an empty line in the import section of `gin.go`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* chore: enhance code quality and consistency
- Add `gin.go` to the list of files with specific linters in `.golangci.yml`, applying the `gci` linter.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
---------
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Sleep for one millisecond in the handler because the `Latency` will return `0s` sometimes and the test will fail
* The `TCPListener.File` is not supported by windows, it is unimplemented now
* Remove the `LF` in the `testdata/template/raw.tmpl`, because if set the git config `core.autocrlf=true`, will append `CR` to the raw.tmpl automatically, then test is failed on Windows
* Update gin_integration_test.go
TestUnixSocket fails if you run it twice in a row. This is due to the unix socket file persisting. Added defer to clean up.
Whats unclear is the following test TestBadUnixSocket I suspect is just looking for cruft maybe from a prior test or defaults not working, I have not enough background to say.
* Update gin_integration_test.go
I believe there is some tab issue here, tried to manual overwrite it now.
* Update gin_integration_test.go
squash you dang spaces!!!
Digging into the test code base I've found out that some of the tests for `LoadHTML*` methods are not reliable and efficient. They use timeouts to be sure that goroutine with the server has started. And even more, in old implementation, the server started only once – all the new instances silently failed due to the occupied network port.
Here is a short overview of the proposed changes:
- it's not necessary to rely on timeouts, the server starts listening synchronously and returns control when it is ready
- once the server is run, it's stopped after a test passes
- dry out http server setup
- magic with empty closure return is eliminated
- preserve router.RunTLS coverage with integration tests
As per #1230 there is an issue when using HandleContext where the context of the request is returned to the context sync.Pool before the parent request has finished, causing context to be used in a non-thread safe manner.
I've removed the bug by not entering the context back in the pool and leaving that to ServeHTTP.
There was no test coverage for this function so I've also added the test to cover it. As the bug only happens when there are concurrent requests, the tests issues hundreds of concurrent requests. Without the bug fixed the tests do consistently recreate the error.