func (t *VersionInfoTranslation) Validate() error {
	if _, err := t.languageID(); err != nil {
		return errors.Wrap(err, "failed to parse language identifier")
	}
	if _, err := t.charsetID(); err != nil {
		return errors.Wrap(err, "failed to parse charset identifier")
	}
	return nil
}
Validate returns data validation result.
package syso
import (
	"bytes"
	"reflect"
	"strconv"
	"github.com/hallazzang/syso/pkg/coff"
	"github.com/hallazzang/syso/pkg/common"
	"github.com/hallazzang/syso/pkg/rsrc"
	"github.com/hallazzang/syso/pkg/versioninfo"
	"github.com/pkg/errors"
)
type VersionInfoResource struct {
	ID           *int
	Name         *string
	Fixed        *VersionInfoFixed
	StringTables []*VersionInfoStringTable
	Translations []*VersionInfoTranslation
}
func (r *VersionInfoResource) Validate() error {
	if r.ID == nil && r.Name == nil {
		return errors.New("resource id or name must be given")
	} else if r.ID != nil && r.Name != nil {
		return errors.New("resource id and name cannot be given at same time")
	} else if r.ID != nil && *r.ID < 1 {
		return errors.Errorf("invalid resource id; %d", *r.ID)
	} else if r.Name != nil && *r.Name == "" {
		return errors.New("resource name cannot be empty")
	}
	if r.Fixed != nil {
		if err := r.Fixed.Validate(); err != nil {
			return err
		}
	}
	for _, st := range r.StringTables {
		if err := st.Validate(); err != nil {
			return err
		}
	}
	for _, t := range r.Translations {
		if err := t.Validate(); err != nil {
			return err
		}
	}
	return nil
}
type VersionInfoFixed struct {
	FileVersion    *string
	ProductVersion *string
}
func (f *VersionInfoFixed) Validate() error {
	if f.FileVersion != nil {
		if _, err := common.ParseVersionString(*f.FileVersion); err != nil {
			return errors.Wrap(err, "failed to parse file version string")
		}
	}
	if f.ProductVersion != nil {
		if _, err := common.ParseVersionString(*f.ProductVersion); err != nil {
			return errors.Wrap(err, "failed to parse product version string")
		}
	}
	return nil
}
type VersionInfoStringTable struct {
	Language *string
	Charset  *string
	Strings  *VersionInfoStrings
}
func (st *VersionInfoStringTable) Validate() error {
	if _, err := st.languageID(); err != nil {
		return errors.Wrap(err, "failed to parse language identifier")
	}
	if _, err := st.charsetID(); err != nil {
		return errors.Wrap(err, "failed to parse charset identifier")
	}
	if st.Strings == nil {
		return errors.New("strings should present")
	}
	return nil
}
func (st *VersionInfoStringTable) languageID() (uint16, error) {
	return parseUint16ID(st.Language, 0x0409)  
}
func (st *VersionInfoStringTable) charsetID() (uint16, error) {
	return parseUint16ID(st.Charset, 0x04b0)  
}
type VersionInfoStrings struct {
	Comments         *string
	CompanyName      *string
	FileDescription  *string
	FileVersion      *string
	InternalName     *string
	LegalCopyright   *string
	LegalTradeMarks  *string
	OriginalFilename *string
	PrivateBuild     *string
	ProductName      *string
	ProductVersion   *string
	SpecialBuild     *string
}
func (res *VersionInfoStrings) fields() [][2]string {
	var result [][2]string
	target := reflect.ValueOf(res).Elem()
	for i := 0; i < target.NumField(); i++ {
		field := target.Type().Field(i)
		value := target.Field(i)
		if !value.IsNil() {
			result = append(result, [2]string{field.Name, value.Elem().String()})
		}
	}
	return result
}
type VersionInfoTranslation struct {
	Language *string
	Charset  *string
}