Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Anonymous struct

package main

import (
	"fmt"
)

func main() {
	ip := struct {
		address string
		name    string
	}{
		address: "127.0.0.1",
		name:    "home"}

	fmt.Println(ip)
	fmt.Println(ip.address)
	fmt.Println(ip.name)
}
{127.0.0.1 home}
127.0.0.1
home