func (e *Encoder) SetTagComment(v string) *Encoder {
	e.comment = v
	return e
}
SetTagComment allows changing default tag "comment"
package toml
import (
	"bytes"
	"encoding"
	"errors"
	"fmt"
	"io"
	"reflect"
	"sort"
	"strconv"
	"strings"
	"time"
)
const (
	tagFieldName    = "toml"
	tagFieldComment = "comment"
	tagCommented    = "commented"
	tagMultiline    = "multiline"
	tagDefault      = "default"
)
type tomlOpts struct {
	name         string
	nameFromTag  bool
	comment      string
	commented    bool
	multiline    bool
	include      bool
	omitempty    bool
	defaultValue string
}
type encOpts struct {
	quoteMapKeys            bool
	arraysOneElementPerLine bool
}
var encOptsDefaults = encOpts{
	quoteMapKeys: false,
}
type annotation struct {
	tag          string
	comment      string
	commented    string
	multiline    string
	defaultValue string
}
var annotationDefault = annotation{
	tag:          tagFieldName,
	comment:      tagFieldComment,
	commented:    tagCommented,
	multiline:    tagMultiline,
	defaultValue: tagDefault,
}
type marshalOrder int
const (
	OrderAlphabetical marshalOrder = iota + 1
	OrderPreserve
)
var timeType = reflect.TypeOf(time.Time{})
var marshalerType = reflect.TypeOf(new(Marshaler)).Elem()
var unmarshalerType = reflect.TypeOf(new(Unmarshaler)).Elem()
var textMarshalerType = reflect.TypeOf(new(encoding.TextMarshaler)).Elem()
var textUnmarshalerType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem()
var localDateType = reflect.TypeOf(LocalDate{})
var localTimeType = reflect.TypeOf(LocalTime{})
var localDateTimeType = reflect.TypeOf(LocalDateTime{})
var mapStringInterfaceType = reflect.TypeOf(map[string]interface{}{})
func isPrimitive(mtype reflect.Type) bool {
	switch mtype.Kind() {
	case reflect.Ptr:
		return isPrimitive(mtype.Elem())
	case reflect.Bool:
		return true
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return true
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		return true
	case reflect.Float32, reflect.Float64:
		return true
	case reflect.String:
		return true
	case reflect.Struct:
		return isTimeType(mtype)
	default:
		return false
	}
}
func isTimeType(mtype reflect.Type) bool {
	return mtype == timeType || mtype == localDateType || mtype == localDateTimeType || mtype == localTimeType
}
func isTreeSequence(mtype reflect.Type) bool {
	switch mtype.Kind() {
	case reflect.Ptr:
		return isTreeSequence(mtype.Elem())
	case reflect.Slice, reflect.Array:
		return isTree(mtype.Elem())
	default:
		return false
	}
}
func isCustomMarshalerSequence(mtype reflect.Type) bool {
	switch mtype.Kind() {
	case reflect.Ptr:
		return isCustomMarshalerSequence(mtype.Elem())
	case reflect.Slice, reflect.Array:
		return isCustomMarshaler(mtype.Elem()) || isCustomMarshaler(reflect.New(mtype.Elem()).Type())
	default:
		return false
	}
}
func isTextMarshalerSequence(mtype reflect.Type) bool {
	switch mtype.Kind() {
	case reflect.Ptr:
		return isTextMarshalerSequence(mtype.Elem())
	case reflect.Slice, reflect.Array:
		return isTextMarshaler(mtype.Elem()) || isTextMarshaler(reflect.New(mtype.Elem()).Type())
	default:
		return false
	}
}
func isOtherSequence(mtype reflect.Type) bool {
	switch mtype.Kind() {
	case reflect.Ptr:
		return isOtherSequence(mtype.Elem())
	case reflect.Slice, reflect.Array:
		return !isTreeSequence(mtype)
	default:
		return false
	}
}
func isTree(mtype reflect.Type) bool {
	switch mtype.Kind() {
	case reflect.Ptr:
		return isTree(mtype.Elem())
	case reflect.Map:
		return true
	case reflect.Struct:
		return !isPrimitive(mtype)
	default:
		return false
	}
}
func isCustomMarshaler(mtype reflect.Type) bool {
	return mtype.Implements(marshalerType)
}
func callCustomMarshaler(mval reflect.Value) ([]byte, error) {
	return mval.Interface().(Marshaler).MarshalTOML()
}
func isTextMarshaler(mtype reflect.Type) bool {
	return mtype.Implements(textMarshalerType) && !isTimeType(mtype)
}
func callTextMarshaler(mval reflect.Value) ([]byte, error) {
	return mval.Interface().(encoding.TextMarshaler).MarshalText()
}
func isCustomUnmarshaler(mtype reflect.Type) bool {
	return mtype.Implements(unmarshalerType)
}
func callCustomUnmarshaler(mval reflect.Value, tval interface{}) error {
	return mval.Interface().(Unmarshaler).UnmarshalTOML(tval)
}
func isTextUnmarshaler(mtype reflect.Type) bool {
	return mtype.Implements(textUnmarshalerType)
}
func callTextUnmarshaler(mval reflect.Value, text []byte) error {
	return mval.Interface().(encoding.TextUnmarshaler).UnmarshalText(text)
}
type Marshaler interface {
	MarshalTOML() ([]byte, error)
}
type Unmarshaler interface {
	UnmarshalTOML(interface{}) error
}
func Marshal(v interface{}) ([]byte, error) {
	return NewEncoder(nil).marshal(v)
}
type Encoder struct {
	w io.Writer
	encOpts
	annotation
	line        int
	col         int
	order       marshalOrder
	promoteAnon bool
	indentation string
}
func NewEncoder(w io.Writer) *Encoder {
	return &Encoder{
		w:           w,
		encOpts:     encOptsDefaults,
		annotation:  annotationDefault,
		line:        0,
		col:         1,
		order:       OrderAlphabetical,
		indentation: "  ",
	}
}
func (e *Encoder) Encode(v interface{}) error {
	b, err := e.marshal(v)
	if err != nil {
		return err
	}
	if _, err := e.w.Write(b); err != nil {
		return err
	}
	return nil
}
func (e *Encoder) QuoteMapKeys(v bool) *Encoder {
	e.quoteMapKeys = v
	return e
}
func (e *Encoder) ArraysWithOneElementPerLine(v bool) *Encoder {
	e.arraysOneElementPerLine = v
	return e
}
func (e *Encoder) Order(ord marshalOrder) *Encoder {
	e.order = ord
	return e
}
func (e *Encoder) Indentation(indent string) *Encoder {
	e.indentation = indent
	return e
}
func (e *Encoder) SetTagName(v string) *Encoder {
	e.tag = v
	return e
}