I could not think of a better (more descriptive) title.
I am learning Go, and I sometimes see the following form for defining a function:
func (c *currency) GetRate (ctx context.Context, rr *protos.RateRequest) (*protos.RateResponse, error) {}
My question:
If this were instead
func GetRate (ctx context.Context, rr *protos.RateRequest) (*protos.RateResponse, error) {}
then I would understand it to be defining a function named “GetRate”, with a list of arguments and return.
What I cannot understand is the use of “func (c *currency)” followed by the name of the function, GetRate.
Can anyone please help me understand?