gorilla / mux

Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍
https://gorilla.github.io
BSD 3-Clause "New" or "Revised" License
20.81k stars 1.85k forks source link

why return a router for the methods strictslash, skipClean and use Encoded Path? #686

Open prr123 opened 2 years ago

prr123 commented 2 years ago

Describe the problem you're having

A clear and concise description of what the bug is. no bug, but an apparent redundant implementation The methods already are linked to a pointer of Router, so there appears no need to return another pointer to the type Router. …

Versions

Go version: go version

package version: run git rev-parse HEAD inside the repo

"Show me the code!"

A minimal code snippet can be useful, otherwise we're left guessing! func (r *Router*) SkipClean(value bool) Router** Hint: wrap it with backticks to format it

amustaque97 commented 2 years ago

@prr123 As far as I know, mux is following the builder pattern here.

prr123 commented 2 years ago

Perhaps the reason is to allow daisy-chaining of methods? i.e. the builder pattern allows for daisy-chaining of methods?

amustaque97 commented 2 years ago

Yes builder pattern will allow method chaining.

ianling commented 2 years ago

This can be closed, unless OP feels the question has not been answered adequately.