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: functions.go
    path of file: ./repos/terraform/internal/plugin/convert
    
    the code of the file until where you have to start completion: // Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

package convert

import (
	"encoding/json
    
func FunctionDeclToProto(fn providers.FunctionDecl) (*tfplugin5.Function, error) {
	ret := &tfplugin5.Function{
		Return: &tfplugin5.Function_Return{},
	}

	ret.Description = fn.Description
	ret.DescriptionKind = protoStringKind(fn.DescriptionKind)

	retTy, err := json.Marshal(fn.ReturnType)
	if err != nil {
		return ret, fmt.Errorf("invalid return type constraint: %s", err)
	}
	ret.Return.Type = retTy

	if len(fn.Parameters) != 0 {
		ret.Parameters = make([]*tfplugin5.Function_Parameter, len(fn.Parameters))
		for i, fnParam := range fn.Parameters {
			protoParam, err := functionParamToProto(fnParam)
			if err != nil {
				return ret, fmt.Errorf("invalid parameter %d (%q): %s", i, fnParam.Name, err)
			}
			ret.Parameters[i] = protoParam
		}
	}
	if fn.VariadicParameter != nil {
		param, err := functionParamToProto(*fn.VariadicParameter)
		if err != nil {
			return ret, fmt.Errorf("invalid variadic parameter (%q): %s", fn.VariadicParameter.Name, err)
		}
		ret.VariadicParameter = param
	}

	return ret, nil
}