I tried this code in golang
type Agent struct {
name string // Not exported
categoryId int // Not exported
}
Then I got this
exported type Agent should have comment or be unexported
The warning is kind of annoying.
How to get rid of it? what comment should I put? Is there any default comment template for this?
It asks me to put a comment but it does not offer me to add one by default.
Just add a comment above it like this:
// Agent is ...
type Agent struct {
name string
categoryId int
}
This comment is because your Agent
type is exported, even if its attributes are not. To not export your type, define it in lowercase like such:
type agent struct {
name string
categoryId int
}