Todd had given this information previously: Structs allow us to compose together values of different types.
In: type circle struct {
radius float64
}, I don’t see different types. So why is it a struct? I looked at the Language Spec. and saw that float64 is a type. Is radius a type?
The . always qualifies something in another thing. Its therefore often called the qualification operator. Others may say its the fieldaccess operator or method call operator, but both names are specialisiations of the former and only valid in a certain context.
Structs compose many types into a single one.
Just think of it as a form.
struct foo {
bar string
}
This creates a “form” with a single “field” you can write things into it. That field is “labeled” bar. You can write anything in that field.
When we change this to be like this:
struct foo {
bar string
quux float64
}
The we get a “form” with two fields, one which can hold any kind of text, the other “field” is only able to have floating point numbers as its input.
It’s an untyped floating point literal. Its final type will be inferred from the context.
No, there is no reciever. In a function definition, the receiver is a single “argument” specified between func and the functions identifier.
But yes, info is the functions identifier, or also its name. At least under the assumptions that this is taken from a function definition.
It is the address of c, passed into a function that expects a certain interface. Since cs type does implement this interface, go does acceppt and will automatically dereference where necessary.
It does, but its still tagged by a type and the compiler can make sense of the combination “address with type”.