I
I
Ivan Soshnikov2015-05-21 22:41:54
go
Ivan Soshnikov, 2015-05-21 22:41:54

[TMPARSERFUCK] map[string]map[string]string is the norm?

I'm just looking at the language. The syntax is... very controversial in places, but such an announcement just killed me. This is some kind of rap.
Is this the norm for Go, or is it just used in a book for kids to make the organization of data clearer?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2015-05-21
@soshnikov

Use the type keyword.

package main

import "fmt"

type item map[string]string

func main() {
  items := map[string]item{
    "one": {"key": "value"},
  }
  fmt.Println(items)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question