code: func GoTypeDef(ds design.DataStructure, tabs int, jsonTags, private bool) string {
  	def := ds.Definition()
  	if tname, ok := def.Metadata["struct:field:type"]; ok {
  		if len(tname) > 0 {
  			return tname[0]
  		}
  	}
  	t := def.Type
  	switch actual := t.(type) {
  	case design.Primitive:
  		return GoTypeName(t, nil, tabs, private)
  	case *design.Array:
  		d := GoTypeDef(actual.ElemType, tabs, jsonTags, private)
  		if actual.ElemType.Type.IsObject() {
  			d = "*" + d
  		}
  		return "[]" + d
  	case *design.Hash:
  		keyDef := GoTypeDef(actual.KeyType, tabs, jsonTags, private)
  		if actual.KeyType.Type.IsObject() {
  			keyDef = "*" + keyDef
  		}
  		elemDef := GoTypeDef(actual.ElemType, tabs, jsonTags, private)
  		if actual.ElemType.Type.IsObject() {
  			elemDef = "*" + elemDef
  		}
  		return fmt.Sprintf("map[%s]%s", keyDef, elemDef)
  	case design.Object:
  		return goTypeDefObject(actual, def, tabs, jsonTags, private)
  	case *design.UserTypeDefinition:
  		return GoTypeName(actual, actual.AllRequired(), tabs, private)
  	case *design.MediaTypeDefinition:
  		return GoTypeName(actual, actual.AllRequired(), tabs, private)
  	default:
  		panic("goa bug: unknown data structure type")
  	}
  }
docs: // GoTypeDef returns the Go code that defines a Go type which matches the data structure
  // definition (the part that comes after `type foo`).
  // tabs is the number of tab character(s) used to tabulate the definition however the first
  // line is never indented.
  // jsonTags controls whether to produce json tags.
  // private controls whether the field is a pointer or not. All fields in the struct are
  //   pointers for a private struct.