Skip to content

Removes ambiguity around "fresh middleware stack" in GoDoc - #862

Merged
pkieltyka merged 1 commit into
go-chi:masterfrom
TheRandomCharacter:doc_fresh_copy
Oct 18, 2023
Merged

pkieltyka merged 1 commit into
go-chi:masterfrom
TheRandomCharacter:doc_fresh_copy

Conversation

@TheRandomCharacter

Copy link
Copy Markdown
Contributor

For Group():

fresh implies that a new empty middleware stack is created, while in fact the parent's stack is copied.

For Route():

Looks like with a fresh middleware stack was added to emphasize that while the parent middleware stack is frozen, one can still add middlewares to new router's stack before starting to define routes on it.

In my opinion this is clear from creates a new Mux. Adding with a fresh middleware stack makes it more obscure that the parent middleware stack will be executed wrapping the new one.

@VojtechVitek VojtechVitek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pkieltyka
pkieltyka merged commit 834f94d into go-chi:master Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants