func (s *Size) UnmarshalJSON(data []byte) error {
	str := string(data)
	if str == "null" {
		return nil
	}
	str = strings.Trim(str, "\"")
	v, err := units.RAMInBytes(str)
	if err != nil {
		return errors.Trace(err)
	}
	*s = Size(v)
	return nil
}
UnmarshalJSON customizes unmarshal
package utils
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"strconv"
	"strings"
	"text/template"
	"github.com/docker/go-units"
	"gopkg.in/validator.v2"
	"gopkg.in/yaml.v2"
	"github.com/baetyl/baetyl-go/v2/errors"
)
func LoadYAML(path string, out interface{}) error {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		return errors.Trace(err)
	}
	res, err := ParseEnv(data)
	if err != nil {
		fmt.Fprintf(os.Stderr, "config parse error: %s", err.Error())
		res = data
	}
	return UnmarshalYAML(res, out)
}
func ParseEnv(data []byte) ([]byte, error) {
	text := string(data)
	envs := os.Environ()
	envMap := make(map[string]string)
	for _, s := range envs {
		t := strings.Split(s, "=")
		envMap[t[0]] = t[1]
	}
	tmpl, err := template.New("template").Option("missingkey=error").Parse(text)
	if err != nil {
		return nil, errors.Trace(err)
	}
	buffer := bytes.NewBuffer(nil)
	err = tmpl.Execute(buffer, envMap)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return buffer.Bytes(), nil
}
func UnmarshalYAML(in []byte, out interface{}) error {
	err := yaml.Unmarshal(in, out)
	if err != nil {
		return errors.Trace(err)
	}
	err = SetDefaults(out)
	if err != nil {
		return errors.Trace(err)
	}
	err = validator.Validate(out)
	if err != nil {
		return errors.Trace(err)
	}
	return nil
}
func UnmarshalJSON(in []byte, out interface{}) error {
	err := json.Unmarshal(in, out)
	if err != nil {
		return errors.Trace(err)
	}
	err = SetDefaults(out)
	if err != nil {
		return errors.Trace(err)
	}
	err = validator.Validate(out)
	if err != nil {
		return errors.Trace(err)
	}
	return nil
}
type Size int64
func (s Size) MarshalYAML() (interface{}, error) {
	return int64(s), nil
}
func (s *Size) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var str string
	err := unmarshal(&str)
	if err != nil {
		return errors.Trace(err)
	}
	v, err := units.RAMInBytes(str)
	if err != nil {
		return errors.Trace(err)
	}
	*s = Size(v)
	return nil
}
func (s Size) MarshalJSON() ([]byte, error) {
	return []byte(strconv.FormatInt(int64(s), 10)), nil
}