You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mapstruct.go
    path of file: ./repos/fq/internal/mapstruct
    
    the code of the file until where you have to start completion: // Package mapstruct maps struct <-> JSON using came case <-> snake case
// also set default values based on struct tags
package mapstruct

// TODO: implement own version as we don't need much?

import (
	"regexp"
	"s
    
func ToStruct(m any, v any) error {
	_ = defaults.Set(v)
	ms, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
		MatchName: func(mapKey, fieldName string) bool {
			return CamelToSnake(fieldName) == mapKey
		},
		TagName: "mapstruct",
		Result:  v,
	})
	if err != nil {
		return err
	}
	if err := ms.Decode(m); err != nil {
		return err
	}

	return nil
}