News for hackers. Stuff that matters.
Re:Lessons learned porting 50k loc from Java to Go by Noumenon72 on Saturday April 06, 2019 @09:16AM (#19590558)
Why is it "q Query"?
Re:Lessons learned porting 50k loc from Java to Go by bbbobbb on Saturday April 06, 2019 @09:23AM (#19590592)
That the "receiver" identifier. You can think of it as "this" or "self" in other languages -> reference to the current "instance" within the method.

https://gobyexample.com/methods

Re:Lessons learned porting 50k loc from Java to Go by ovao on Saturday April 06, 2019 @09:23AM (#19590589)
In Go, the type follows the identifier. To use a single letter or short sequence of letters is idiomatic Go for short-lived identifiers or ‘quintessential’ identifiers.
Re:Lessons learned porting 50k loc from Java to Go by dewey on Saturday April 06, 2019 @09:24AM (#19590594)
q of type Query. So in the function you can access the fields on q (Where you call the function on) via q.FieldName. If you do it with a pointer receiver (q *Query) like explained here (https://tour.golang.org/methods/4) you can directly manipulate the object, not the copy like in this example.