8 examples of 'golang function' in Go

Every line of 'golang function' 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
this disclaimer
119func (mv *mooncakeVisitor) VisitFunction(ctx *parser.FunctionContext) interface{} {
120 log.Printf("VisitFunction - %v", ctx.GetText())
121 return mv.Visit(ctx)
122}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

1353func translateFunc(ut ut.Translator, fe validator.FieldError) string {
1354
1355 t, err := ut.T(fe.Tag(), fe.Field())
1356 if err != nil {
1357 log.Printf("警告: 翻译字段错误: %#v", fe)
1358 return fe.(error).Error()
1359 }
1360
1361 return t
1362}
94func (v *Basegrulev3Visitor) VisitFunctionCall(ctx *FunctionCallContext) interface{} {
95 return v.VisitChildren(ctx)
96}
182func (u utils) function() string {
183 return functionRegex.ReplaceAllString(u.GoSyntax, "_")
184}
127func (s *ParseContext) Function() IFunctionContext {
128 var t = s.GetTypedRuleContext(reflect.TypeOf((*IFunctionContext)(nil)).Elem(), 0)
129
130 if t == nil {
131 return nil
132 }
133
134 return t.(IFunctionContext)
135}
68func (self *luaState) ToGoFunction(index int) GoFunction {
69 val := self.stack.get(index)
70 switch x := val.(type) {
71 case GoFunction:
72 return x
73 default:
74 return nil
75 }
76}
144func (o *Object) FunctionValue() FuncStub {
145 contract.Assertf(o.value != nil, "Expected Function object to carry a Value; got nil")
146 r, ok := o.value.(FuncStub)
147 contract.Assertf(ok, "Expected Function object's Value to be a Function")
148 return r
149}
9func fn2(x int) bool {
10 println(x)
11 if x > 10 {
12 return true
13 }
14 return fn2(x + 1)
15}

Related snippets