Y.Horie
0643f42190
ci: re-enable gocritic deferInLoop check ( #2288 )
...
deferInLoop was disabled in .golangci.yml, so CI could not catch defer
statements added inside for loops. Such defers run only at function exit,
not per iteration, leaking file descriptors, connections, or locks under
load.
Re-enable the check and fix the two existing occurrences in test code
instead of excluding test files:
- inmemory listener test: deferred conn.Close() inside the accept loop;
move the per-connection handling into a closure so each connection is
closed when done.
- TestClientManyServers: every server must stay up until the test ends,
so hoist the defer out of the loop and stop all servers in a single
deferred loop.
Fixes #2233
Signed-off-by: Y.Horie <u5.horie@gmail.com >
2026-06-13 05:49:39 +02:00
Erik Dubbelboer
4ef0547d4c
bug: InMemoryListener deadlock under high concurrency ( #2245 ) ( #2277 )
2026-06-06 11:28:07 +02:00
pj
6fcfcb1ac0
export ErrConnectionClosed ( #2152 )
2026-03-04 08:40:34 +09:00
Erik Dubbelboer
c2b317d47d
Go 1.26 and golangci-lint updates ( #2146 )
...
Keep Go 1.24 compatibility for now (by not using `wg.Go()`).
2026-02-21 10:28:39 +01:00
Erik Dubbelboer
0ad54a45d9
Update lint and fix new lint errors
2025-09-28 02:59:00 +02:00
Erik Dubbelboer
4d25421ae5
Drop Go 1.23 support ( #2065 )
...
The Go team doesn't support this version anymore. This is required to
update our golang.org/x/... dependencies.
2025-09-10 22:16:01 +02:00
Erik Dubbelboer
d356cacd84
Implement io.StringWriter on some more types ( #2023 )
...
In theory this can optimize some code paths where a string first needs
to be converted to a []byte to use the normal Write method. By
implementing WriteString this extra copy isn't needed. Internall we
don't do the copy and just use s2b instead.
2025-06-19 08:59:25 +02:00
Juan Calderon-Perez
1fb3453165
Use Named Fields and Align Structures to Reduce Memory Usage ( #1814 )
...
* Use Named fields and Align Structures to Reduce Memory Usage
* Remove extra spaces
2024-08-02 22:26:52 +02:00
Oleksandr Redko
f196617f55
chore: Use 'any' instead of 'interface{}' ( #1666 )
...
gofmt -w -r "interface{} -> any" -l .
2023-11-24 11:33:04 +01:00
Ilya Selivanau
00419bebec
chore: move rsa.key, rsa.pem to test variables ( #1621 )
2023-09-15 12:31:28 +02:00
Oleksandr Redko
ffdf59d04c
Enable gofumpt linter; format code gofumpt -w . ( #1576 )
2023-06-13 15:18:59 +02:00
Erik Dubbelboer
fa72f3cc39
Fix tests ( #1552 )
2023-05-07 14:32:14 +02:00
Oleksandr Redko
b79a03aaf9
test: close response body ( #1496 )
2023-02-15 11:54:23 +01:00
Oleksandr Redko
934f04e330
Refactor golangci-lint config and remove redundant nolints ( #1486 )
...
* Refactor golangci-lint config
- Use golangci-lint-action for GitHub workflow.
- Add additional golangci-lint run options.
- Remove unused nolint directives.
* Revert exclude-use-default option
2023-02-11 15:35:15 +08:00
Tobias Krischer
951f5a154c
add optional simulated addresses to pipeconn and inmemorylistener ( #1449 )
...
* add optional simulated addresses to pipeconn and inmemorylistener
* add mutexes to addresses of pipeConn and InmemoryListener
2022-12-07 13:31:42 +08:00
Andy Pan
b32a3dda13
Use time.Until(deadline) instead of -time.Since(deadline) ( #1434 )
2022-11-16 06:13:29 +02:00
Aoang
a696949f6c
Deprecate Go 1.15 ( #1379 )
...
* Dropping support for 1.15.
* Replaces Go 1.16 Deprecated functions
* Update test build flag
* Fix import sort and comment
* Update github.com/klauspost/compress to v1.15.9
https://github.com/klauspost/compress improved performance and changed Minimum version is 1.16, this should be the final supported release for Go 1.16 (https://github.com/klauspost/compress/commit/6d0019a95afa3221f7522d1f2eed0033b5e79470 ) .
2022-09-15 22:28:25 +03:00
Erik Dubbelboer
79ccfff72b
Don't use tls ClientSessionCache
...
net/http doesn't use it either. Some servers have issues with this
preventing fasthttp from working:
https://github.com/valyala/fasthttp/issues/1364
https://github.com/valyala/fasthttp/issues/1296
https://github.com/valyala/fasthttp/issues/1335
https://github.com/valyala/fasthttp/issues/984
Also removed code that benchmarks crypto/tls as that has nothing to do
with fasthttp.
2022-08-28 10:13:03 +02:00
Aoang
ea6052464e
Add Go 1.19 Support ( #1355 )
...
* Update Go Version to Go1.19.x And add cache
* Fix CI Line endings
* Update test CI Go Version to Go1.19.x And add cache
* Update Gosec Security Scanner CI to securego/gosec@v2.12 .0
* Format comment
Go 1.19 adds support for links, lists, and clearer headings in doc comments. As part of this change, gofmt now reformats doc comments to make their rendered meaning clearer. See “Go Doc Comments” for syntax details and descriptions of common mistakes now highlighted by gofmt. As another part of this change, the new package go/doc/comment provides parsing and reformatting of doc comments as well as support for rendering them to HTML, Markdown, and text.
ref: https://tip.golang.org/doc/go1.19
ref: https://tip.golang.org/doc/comment
* Fix doc structure
2022-08-14 11:31:57 +02:00
Erik Dubbelboer
7a5afddf5b
Use %v for errors and %q for strings ( #1262 )
...
Mostly in tests.
2022-04-01 18:11:16 +02:00
Erik Dubbelboer
e9db537178
Use %w to wrap errors ( #1175 )
2021-12-13 09:41:34 +01:00
Erik Dubbelboer
9f2c63676d
Lower go test time
2021-06-18 14:57:18 +02:00
Erik Dubbelboer
34a61fe63f
Update linting ( #851 )
2020-07-17 14:22:28 +02:00
Erik Dubbelboer
cc9db3ab20
Try TravisCI Windows ( #828 )
...
* Try TravisCI Windows
* prefork is supported on windows with Reuseport=true
* Bit longer timeouts for tests
2020-06-06 15:57:38 +02:00
RENAN.BASTOS
695f713fcf
feat: workflow to verify security using GoSec ( #747 )
...
* feat: workflow to valid security using GoSec
* Update security.yml
* Fix gosec problems
These are all either false positives or os.Open operations done on
filenames supplied by the fasthttp user which we have to assume is safe.
* Just ignore some rules globally
* Fix more warnings
* No more warnings
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2020-02-28 21:03:48 +01:00
Erik Dubbelboer
69d5c3721a
Client should return ErrTimeout on timeout ( #736 )
...
Not ErrConnectionClosed which is incorrect.
Fixes: https://github.com/valyala/fasthttp/issues/355
2020-01-31 22:21:00 +01:00
Andy Pan
59b28fe0e5
Resolve code issues from goreportcard.com ( #725 )
2020-01-12 12:57:42 +01:00
Erik Dubbelboer
32793db72d
Run golangci-lint using a Github Action
2019-11-16 18:09:28 +01:00
ZhangYunHao
18c619fb04
fasthttputil: add errInmemoryListenerClosed ( #678 )
...
* add errInmemoryListenerClosed
* Fix test error
* Expose ErrInmemoryListenerClosed
* rename
2019-10-22 15:55:44 +08:00
Erik Dubbelboer
4ebe993965
Document PipeConns not being safe for concurrent use
2019-10-16 10:20:13 +02:00
rogercarter1
044d35e5ef
fix 664 ( #674 )
2019-10-16 16:18:52 +08:00
Kazushi Kitaya
8713335f54
Fix data race in fasthttputil.pipeConn ( #645 )
...
* add tests for fasthttputil.InmemoryListener
* fix data race in pipeConn
* update use of readDeadlineChLock
2019-09-04 17:57:51 +02:00
Erik Dubbelboer
aaec9b0fe2
Make InmemoryListener.Dial return when the connection is accepted
...
This makes InmemoryListener deterministic which makes our tests much
less flacky under high load or when GOMAXPROCS=1
2019-02-02 23:40:05 +01:00
Erik Dubbelboer
2cc8e6be6d
go fmt ./...
2018-08-29 20:26:12 +08:00
xPushkin
f24d00fcc6
A lot of typo fixes
2017-10-08 13:30:35 +01:00
Aliaksandr Valialkin
8b2cc86299
fasthttputil: added TLS benchmarks for ECDSA certificates
...
Handshakes with ECDSA certificates are optimized much better
comparing to RSA certificates - see https://github.com/golang/go/issues/20058 .
2017-04-24 14:16:32 +03:00
Aliaksandr Valialkin
8d2055d00a
fasthttputil: added TLS benchmarks for handshakes with elliptic curves
2017-04-20 19:05:57 +03:00
Aliaksandr Valialkin
2c5a87147a
fasthttputil: added BenchmarkTLSHandshakeWithoutClientSessionCache
2017-04-20 12:31:46 +03:00
Aliaksandr Valialkin
31a397777b
fasthttputil.PipeConns: add read/write deadline support
2016-09-26 18:09:21 +03:00
Aliaksandr Valialkin
c665919a09
Fixed a race when reading data from pipe. This fixes flacky tests involving fasthttputil.PipeConns: TestResponseGzipStream and TestWorkerPoolMaxWorkersCountSerial
2016-08-17 17:42:10 +03:00
Aliaksandr Valialkin
80af8b2b97
Simplified PipeConns - now they properly handle the case when reader side is closed
2016-06-10 19:56:11 +03:00
Aliaksandr Valialkin
7c6a3278ad
Improved testPipeConnsCloseWhileReadWrite
2016-06-10 18:24:42 +03:00
Aliaksandr Valialkin
312f9e5633
move inmemory_listener_timing_test to *_test package, so it could import fasthttp without cycle
2016-06-10 17:48:06 +03:00
Aliaksandr Valialkin
2a92d3c96e
Reduced concurrency and increased wait time in TestPipeConnsCloseWhileReadWriteConcurrent, so it may pass on slow CPUs and/or with -race flag
2016-03-01 13:57:24 +02:00
Aliaksandr Valialkin
1e8901b798
fasthttputil: added concurrent test for closing PipeConns while reading/writing from it
2016-03-01 13:53:57 +02:00
Aliaksandr Valialkin
69793f7224
Fixed data races in PipeConns
2016-03-01 02:03:26 +02:00
Aliaksandr Valialkin
f340a2920f
Moved expvarhandler from fasthttputil to fasthttp root
2016-02-05 18:13:16 +02:00
Aliaksandr Valialkin
8ccfb7fc1c
Added docs to expvar
2016-02-05 18:10:23 +02:00
Aliaksandr Valialkin
5dcb652364
Moved ExpvarHandler to a dedicated package in order to break import cycle
2016-02-05 18:06:54 +02:00
Aliaksandr Valialkin
ec922ac0b8
typo fix
2016-02-05 17:46:49 +02:00