Skip to content

Instantly share code, notes, and snippets.

@akovardin
Created July 3, 2018 09:20
Show Gist options
  • Select an option

  • Save akovardin/aa6772b7271c9efeddea07258c5ec3d0 to your computer and use it in GitHub Desktop.

Select an option

Save akovardin/aa6772b7271c9efeddea07258c5ec3d0 to your computer and use it in GitHub Desktop.
Map modification
package main
import (
"fmt"
)
func call() {
mm := m()
fmt.Println(mm)
mf(mm)
fmt.Println(mm)
}
func mf(mm map[int]*int) {
b := 2
mm[1] = &b
}
func m() map[int]*int {
a := 1
mm := map[int]*int{1: &a}
return mm
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment