Operator and syntax

Go selectors

Dot selects accessible fields or methods; a qualified identifier uses a package name and exported identifier. Selectors can follow promotion rules with embedding. Example output: '7'.

Formal Syntax & Structure

go syntaxgo
x.Field; x.Method

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  type Point struct{ X int }  p := Point{X: 7}  fmt.Println(p.X)}
Go Reference