diff options
author | 2023-02-24 14:46:43 +0000 | |
---|---|---|
committer | 2023-02-24 14:46:43 +0000 | |
commit | 4fd7e741405494160b367033fc9164361e917b64 (patch) | |
tree | 38be68841ec95bbd5a223a5a1e91b1ad77396659 /starlark_fmt | |
parent | a865f4e905b49620d6634bc3b3cf897d91f5e114 (diff) |
Revert^2 "refactor of api_levels map for soong injection"
a865f4e905b49620d6634bc3b3cf897d91f5e114
Change-Id: Ifea020ac83725df7131773ca587c56931f5cdf03
Diffstat (limited to 'starlark_fmt')
-rw-r--r-- | starlark_fmt/format.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/starlark_fmt/format.go b/starlark_fmt/format.go index 3e51fa14c..064fc2169 100644 --- a/starlark_fmt/format.go +++ b/starlark_fmt/format.go @@ -17,6 +17,7 @@ package starlark_fmt import ( "fmt" "sort" + "strconv" "strings" ) @@ -84,6 +85,16 @@ func PrintBoolDict(dict map[string]bool, indentLevel int) string { return PrintDict(formattedValueDict, indentLevel) } +// PrintStringIntDict returns a Starlark-compatible string formatted as dictionary with +// string keys and int values. +func PrintStringIntDict(dict map[string]int, indentLevel int) string { + valDict := make(map[string]string, len(dict)) + for k, v := range dict { + valDict[k] = strconv.Itoa(v) + } + return PrintDict(valDict, indentLevel) +} + // PrintDict returns a starlark-compatible string containing a dictionary with string keys and // values printed with no additional formatting. func PrintDict(dict map[string]string, indentLevel int) string { |