10 examples of 'golang map literal' in Go

Every line of 'golang map literal' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Go code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
102func (v *BaseApiParserVisitor) VisitMapType(ctx *MapTypeContext) interface{} {
103 return v.VisitChildren(ctx)
104}
127func (e *encoder) mapv(tag string, in reflect.Value) {
128 e.mappingv(tag, func() {
129 for _, k := range in.MapKeys() {
130 e.marshal("", k)
131 e.marshal("", in.MapIndex(k))
132 }
133 })
134}
2314func (s *LiteralOrMathContext) LiteralValue() ILiteralValueContext {
2315 var t = s.GetTypedRuleContext(reflect.TypeOf((*ILiteralValueContext)(nil)).Elem(), 0)
2316
2317 if t == nil {
2318 return nil
2319 }
2320
2321 return t.(ILiteralValueContext)
2322}
92func (u *unmarshalGen) gStruct(s *Struct, x *extra) {
93 u.depth++
94 defer func() {
95 u.depth--
96 }()
97
98 if !u.p.ok() {
99 return
100 }
101 if u.cfg.AllTuple || s.AsTuple {
102 u.tuple(s)
103 } else {
104 u.mapstruct(s)
105 }
106 return
107}
802func MapOf(k, v interface{}, fn ...func()) *design.Map {
803 return dsl.MapOf(k, v, fn...)
804}
2260func (s *DirectoryPhraseContext) Literal() ILiteralContext {
2261 var t = s.GetTypedRuleContext(reflect.TypeOf((*ILiteralContext)(nil)).Elem(), 0)
2262
2263 if t == nil {
2264 return nil
2265 }
2266
2267 return t.(ILiteralContext)
2268}
51func (v *BaseMooncakeVisitor) VisitLiteral(ctx *LiteralContext) interface{} {
52 return v.VisitChildren(ctx)
53}
1024func (p *Parser) parseMapElementLit() *MapElementLit {
1025 if p.trace {
1026 defer untracep(tracep(p, "MapElementLit"))
1027 }
1028
1029 pos := p.pos
1030 name := "_"
1031 if p.token == token.Ident {
1032 name = p.tokenLit
1033 } else if p.token == token.String {
1034 v, _ := strconv.Unquote(p.tokenLit)
1035 name = v
1036 } else {
1037 p.errorExpected(pos, "map key")
1038 }
1039 p.next()
1040 colonPos := p.expect(token.Colon)
1041 valueExpr := p.parseExpr()
1042 return &MapElementLit{
1043 Key: name,
1044 KeyPos: pos,
1045 ColonPos: colonPos,
1046 Value: valueExpr,
1047 }
1048}
1775func (x *NameSpace) GetMapType() string {
1776 if x != nil {
1777 return x.MapType
1778 }
1779 return ""
1780}
777func (m *DtUpdateResp) GetMapValue() []*MapEntry {
778 if m != nil {
779 return m.MapValue
780 }
781 return nil
782}

Related snippets