In Go is naming the receiver variable 'self' misleading or good practice?

前端 未结 6 1451
青春惊慌失措
青春惊慌失措 2020-12-01 02:42

I have seen a fair amount of blogs & videos on Go and as far as I recall, none of the authors use \'self\' or \'this\' for the receiver variable when writing methods. H

6条回答
  •  日久生厌
    2020-12-01 03:11

    The Go wiki recommends not using terms like this or self and instead using abbreviations derived from the type name: https://github.com/golang/go/wiki/CodeReviewComments#receiver-names

提交回复
热议问题