Skip to content

Instantly share code, notes, and snippets.

@ravlio
Last active June 22, 2016 20:34
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 ravlio/2d56975c7da71a180e930ac9ac352366 to your computer and use it in GitHub Desktop.
Save ravlio/2d56975c7da71a180e930ac9ac352366 to your computer and use it in GitHub Desktop.
declarations and assignments of slices and maps
package main
import "fmt"
var a []int
var b []int = []int{1, 2, 3}
var c map[string]int
var d map[string]*int = map[string]*int{"test":new(int)}
var e [4]int
var f map[string]int = map[string]int{}
var g map[string]int = make(map[string]int)
func main() {
f["test"] = 1
g["t"] = 1
fmt.Printf("%v,%v,%v,%v,%v,%v,%v", a, b, c, d, e, f, g)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment