Skip to content

Instantly share code, notes, and snippets.

@zskamljic
Created November 14, 2017 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zskamljic/82101d865753fe23387f349064fa1954 to your computer and use it in GitHub Desktop.
Save zskamljic/82101d865753fe23387f349064fa1954 to your computer and use it in GitHub Desktop.
type User struct {
Name string `json:"first_name"`
age int `json:"age"`
}
func (u User) PrintHello() {
fmt.Printf("Hello %s\n", u.Name)
}
func (u *User) SetAge(age int) {
u.Age = age
}
// ...
user.PrintHello()
user.SetAge(23)
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment