I am having trouble understanding the Equals keyword in this context. Could someone explain whether it is a type or a function as I am not able to find docs for golang pertaining to this. https://github.com/ory/ladon/blob/9fada03c11c183e37c13f581ee6deca8d8e747f9/condition_string_equal.go#L19-L21
A struct is a user-defined type in golang having a group of fields. So in your case
type StringEqualCondition struct {
Equals string `json:"equals"`
}
StringEqualCondition is a struct having a field named Equals.
It's just a simple variable of type string in the struct.
It's not a keyword, is the variable (struct member, actually) name.
In golang
, the format to declare a variable is name type
. Thus, on that line, a member named Equals of type string is defined. The capital letter means public visibility.
This isn't the golang documentation, Equals is not a keyword, and it's not a type or a function in the code that you linked; it's the name of a struct field.