Завершена инициализация структуры Go:
type Console struct {
X int
Y int
}
// Regular use case, create a function for easy create.
func NewConsole(x, y int) *Console {
return &Console{X: x, Y: y}
}
// "Manually" create the object (Pointer version is same as non '&' version)
consoleP := &Console{X: 1, Y: 2}
console := Console{X: 1, Y: 2}
// Inline init
consoleInline := struct {
X int
Y int
}{
X: 1,
Y: 2,
}