Home > Back-end >  r and w in ResponseWriter and Request Golang
r and w in ResponseWriter and Request Golang

Time:03-06

This is a bit a silly question but I wanted to ask that can I use any name instead of r and w in the w http.ResponseWriter, r *http.Request or should it be r and w always?

Thanks

CodePudding user response:

It doesn't matter the name of the parameter, you just need to obey the function signature

func (firstParameter http.ResponseWriter, secondParameter http.ResponseWriter)

CodePudding user response:

I believe what you asking is, is it idomatic to use r and w. I don’t think it is. So long as you give the parameters reasonable names (i.e. they don’t hinder readability) you are fine.

  •  Tags:  
  • go
  • Related