* refactor(context): refactor keys to `map[any]any`
Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
* refactor(context): refactor keys to `map[any]any`
Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
* style(context): remove empty lines before GetInt16, GetIntSlice, and GetStringMapString methods
- Remove unnecessary empty lines in the context.go file
- Improve code readability and consistency
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
* refactor(context): simplify GetStringSlice function
- Replace manual type assertion with generic getTyped function
- Reduce code duplication and improve type safety
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
* test(context): improve context.Set and context.Get tests
- Split existing test into separate functions for different scenarios
- Add test for setting and getting values with any key type
- Add test for handling non-comparable keys
- Improve assertions to check for key existence and value correctness
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
* refactor(context): replace fmt.Errorf with fmt.Sprintf in panic message
* test(context): remove trailing hyphen from context_test.go
* refactor(context): improve error message for missing key in context
- Remove unnecessary quotes around the key in the error message
- Simplify the error message format for better readability
* test(context): improve panic test message for non-existent key
---------
Signed-off-by: Flc゛ <four_leaf_clover@foxmail.com>
Signed-off-by: flc1125 <four_leaf_clover@foxmail.com>
* 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>
* 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
Add a function `ForceConsoleColor`, like `DisableConsoleColor` but to force coloring the output.
It usefull when some IDE's integrated console (like IntelliJ or Goland) are not detected as TTY, but can display colors.
Also helps if one want to output color in log file (#1590) and as a workaround for #1547.
1. Why is this change neccesary?
White text on a yellow background was illegible with most terminal color schemes
2. How does it address the issue?
The white text was replaced with a bash compatible dark gray while keeping the
yellow background colour
3. What side effects does this change have?
Resolves#1552
Otherwise, caller needs to invoke WriteHeaderNow himself after
AbortWithStatus(), which is error-prone.
Also modified ErrorLoggerT() such that it always writes log to response
body. Otherwise calling AbortWithStatus() will fail to write body because
c.Writer.Written() is set true by WriteHeaderNow().