MCPcopy Index your code
hub / github.com/Masterminds/sprig / strval

Function strval

strings.go:174–187  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

172}
173
174func strval(v interface{}) string {
175 switch v := v.(type) {
176 case string:
177 return v
178 case []byte:
179 return string(v)
180 case error:
181 return v.Error()
182 case fmt.Stringer:
183 return v.String()
184 default:
185 return fmt.Sprintf("%v", v)
186 }
187}
188
189func trunc(c int, s string) string {
190 if c < 0 && len(s)+c > 0 {

Callers 4

quoteFunction · 0.85
strsliceFunction · 0.85
dictFunction · 0.85
sortAlphaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…