mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-28 23:08:59 +02:00
marshalJSONString collapses 62 identical marshal-and-return blocks in the gomobile exports; jsError/jsSuccess collapse 135 goja extension-response maps; the two MusicBrainz fetchers share one request+retry helper; the extension-HTTP default User-Agent block and fileExists get single homes. No exported signature changes.
14 lines
300 B
Go
14 lines
300 B
Go
package gobackend
|
|
|
|
import "encoding/json"
|
|
|
|
// marshalJSONString marshals v and returns it as a string, the shape every
|
|
// gomobile export returns.
|
|
func marshalJSONString(v any) (string, error) {
|
|
jsonBytes, err := json.Marshal(v)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return string(jsonBytes), nil
|
|
}
|