(v *Visitor, ctx *parser.FunctionCallContext)
| 78 | } |
| 79 | |
| 80 | func httpRun(v *Visitor, ctx *parser.FunctionCallContext) interface{} { |
| 81 | paramValues := v.buildParamValues(ctx) |
| 82 | p0 := paramValues[0] |
| 83 | var addr string |
| 84 | switch p0.(type) { |
| 85 | case string: |
| 86 | addr = fmt.Sprintf("%s", p0) |
| 87 | } |
| 88 | |
| 89 | if addr != "" { |
| 90 | ip := externalIP() |
| 91 | fmt.Println(fmt.Sprintf("http host %s on port%s", ip, addr)) |
| 92 | err := http.ListenAndServe(addr, nil) |
| 93 | if err != nil { |
| 94 | log.RuntimePanic(ctx, fmt.Sprintf("httpRun function error occurred,error:%s", err)) |
| 95 | } |
| 96 | } else { |
| 97 | log.RuntimePanic(ctx, fmt.Sprintf("addr cannot be empty")) |
| 98 | } |
| 99 | |
| 100 | return nil |
| 101 | } |
| 102 | |
| 103 | func fprintfJSON(v *Visitor, ctx *parser.FunctionCallContext) interface{} { |
| 104 | paramValues := v.buildParamValues(ctx) |
nothing calls this directly
no test coverage detected