MCPcopy Create free account
hub / github.com/zalando/skipper / argsString

Function argsString

eskip/string.go:47–80  ·  view source on GitHub ↗
(args []interface{})

Source from the content-addressed store, hash-verified

45}
46
47func argsString(args []interface{}) string {
48 var sargs []string
49 for _, a := range args {
50 switch v := a.(type) {
51 case int:
52 sargs = appendFmt(sargs, "%d", a)
53 case float64:
54 f := "%g"
55
56 // imprecise elimination of 0 decimals
57 // TODO: better fix this issue on parsing side
58 if math.Floor(v) == v {
59 f = "%.0f"
60 }
61
62 sargs = appendFmt(sargs, f, a)
63 case string:
64 sargs = appendFmtEscape(sargs, `"%s"`, `"`, a)
65 default:
66 if m, ok := a.(interface{ MarshalText() ([]byte, error) }); ok {
67 t, err := m.MarshalText()
68 if err != nil {
69 sargs = append(sargs, `"[error]"`)
70 } else {
71 sargs = appendFmtEscape(sargs, `"%s"`, `"`, string(t))
72 }
73 } else {
74 sargs = appendFmtEscape(sargs, `"%s"`, `"`, a)
75 }
76 }
77 }
78
79 return strings.Join(sargs, ", ")
80}
81
82func sortTail(s []string, from int) {
83 if len(s)-from > 1 {

Callers 4

predicateStringMethod · 0.85
filterStringMethod · 0.85
StringMethod · 0.85
StringMethod · 0.85

Calls 3

appendFmtFunction · 0.85
appendFmtEscapeFunction · 0.85
JoinMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…