Skip to content

Commit

Permalink
Apply fieldalignment fixes to optimize struct memory layout (#974)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixel365 authored Feb 5, 2025
1 parent 72fbe46 commit e846b83
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion middleware/throttle.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ type token struct{}
type throttler struct {
tokens chan token
backlogTokens chan token
retryAfterFn func(ctxDone bool) time.Duration
backlogTimeout time.Duration
statusCode int
retryAfterFn func(ctxDone bool) time.Duration
}

// setRetryAfterHeaderIfNeeded sets Retry-After HTTP header if corresponding retryAfterFn option of throttler is initialized.
Expand Down
4 changes: 2 additions & 2 deletions middleware/wrap_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ type WrapResponseWriter interface {
// http.ResponseWriter interface.
type basicWriter struct {
http.ResponseWriter
wroteHeader bool
tee io.Writer
code int
bytes int
tee io.Writer
wroteHeader bool
discard bool
}

Expand Down
8 changes: 4 additions & 4 deletions mux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,11 +644,11 @@ func TestMuxHandlePatternValidation(t *testing.T) {
testCases := []struct {
name string
pattern string
method string
path string
expectedBody string
expectedStatus int
shouldPanic bool
method string // Method to be used for the test request
path string // Path to be used for the test request
expectedBody string // Expected response body
expectedStatus int // Expected HTTP status code
}{
// Valid patterns
{
Expand Down
2 changes: 1 addition & 1 deletion path_value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ func TestPathValue(t *testing.T) {
name string
pattern string
method string
pathKeys []string
requestPath string
expectedBody string
pathKeys []string
}{
{
name: "Basic path value",
Expand Down

0 comments on commit e846b83

Please sign in to comment.