Most OpenTofu executions will not have tracing enabled, so it's important
that we don't waste time calculating data for trace attributes that will
immediately get discarded without being recorded.
This commit establishes the first of possibly multiple utilities that
take a span and then compute a result only if that span is actually going
to be recorded somewhere.
This first one is intended for populating StringSlice attributes from
collections of objects that implement fmt.Stringer. Both the conversion
to string and the construction of the final slice are likely to cause
memory allocation, so we'd rather not do any of that work unless trace
collection is actually enabled.
Signed-off-by: Martin Atkins <mart@degeneration.co.uk>