I'm trying to learn Go, using Visual Studio Code, and I guess it's using a Go linter. I created this struct to map a JSON object into.
type someAPI struct {
ApiEndpoint string `json:"apiEndpoint"`
ApiVersion string `json:"apiVersion"`
...
}
And I get these warnings...
struct field ApiEndpoint should be APIEndpoint
struct field ApiVersion should be APIVersion
I did some Googling and I can not find any requirements for struct field names regarding this. The most I've found is that if you want to make a field public you have to capitalize it.
So why is this linter warning me about these names?
I did some testing by changing Api
to Abc
and the linter didn't warn me to change it to "ABC". So I have to assume it's checking for names that start with "Api".
What are Go conventions for field names? Or in other words, are there other conventions I should know about?