4 ms·
Does anyone else have this problem with go indentation: func (sc *SimpleClient) Timing(s string, d time.Duration, sampleRate float64, tags map[stri
by Buge 9y ago
Does anyone else have this problem with go indentation:
func (sc *SimpleClient) Timing(s string, d time.Duration, sampleRate float64,
tags map[string]string) error {
return sc.send([...]
The wrapped parameter list is indented to the same level as the function body. Is this how it's supposed to be done?
- dilap 9y agoSurprisingly, it is. (Though personally in Go I wouldn't wrap the parameter list at all (and I think maybe most also doesn't?). Then you just let your editor soft-wrap to match current window width; the continued line indent can be configured per personal taste.)
- flashmob 9y agoNo problem with that indenting here (personal opinion), I guess makes it easier to read if your editor doesn't have soft-wraps. However, generally, if the parameters list overflow to another line like that, it becomes a good candidate for refactoring!
- farnsworthy 9y agoYeah, it could be a new struct, especially if another parameter or two comes along (though the simplest thing has its benefits, too).