Hi,

This is a question or suggestion.

The blocks used in this example of grouping routes are quite confusing.

v1 := router.Group("/v1")
{
  v1.POST("/login", loginEndpoint)
  v1.POST("/submit", submitEndpoint)
  v1.POST("/read", readEndpoint)
}

I had similar confusion as asked in this question.

At a glance, it looked like the blocks were a part of the router.Group("/v1") statement, like a struct being initialized with a struct literal.

My question: Are there any reasons the blocks were used?

If there aren't, I think the blocks should be removed to avoid confusion.

Thanks

Comment From: SJrX

Just saw this bug report, I ended up hitting up the Liberia.chat go channel with this a few weeks ago being very confused about what that was actually doing if anything.

Comment From: miles-ton

yes, i agree with this is very confusing. when i first saw this code, i thought this block was the part of Group() returned value initializing code. after analysis, i think it just a simply separating code block, have not any other semantic.