func AddGame(val string) Updater {
	return func(r *RawConfigMode, typ ModeType) error {
		pkg, err := gamepkg.New(val, "")
		if err != nil {
			return errors.New("Invalid game package: " + err.Error())
		}
		r.Games = r.Games.AddGame(pkg.Import())
		return nil
	}
}
AddGame adds the given value to the Games node. Val can be a path or import;
in either case it's looked up via gamepkg, and its Import() is used if the
package is valid. Returns an error if the package isn't valid.
package config
import (
	"errors"
	"github.com/jkomoros/boardgame/boardgame-util/lib/gamepkg"
)
type Updater func(r *RawConfigMode, typ ModeType) error
func SetString(field ModeField, val string) Updater {
	return func(r *RawConfigMode, typ ModeType) error {
		switch field {
		case FieldAllowedOrigins:
			r.AllowedOrigins = val
		case FieldDefaultPort:
			r.DefaultPort = val
		case FieldDefaultStaticPort:
			r.DefaultStaticPort = val
		case FieldDefaultStorageType:
			r.DefaultStorageType = val
		case FieldGoogleAnalytics:
			r.GoogleAnalytics = val
		case FieldAPIHost:
			r.APIHost = val
		default:
			return errors.New(string(field) + " is not a valid string property")
		}
		return nil
	}
}
func DeleteString(field ModeField) Updater {
	return SetString(field, "")
}
func AddString(field ModeField, val string) Updater {
	return func(r *RawConfigMode, typ ModeType) error {
		if field != FieldAdminUserIds {
			return errors.New(string(field) + " is not a []string field")
		}
		for _, rec := range r.AdminUserIds {
			if rec == val {
				return nil
			}
		}
		r.AdminUserIds = append(r.AdminUserIds, val)
		return nil
	}
}
func RemoveString(field ModeField, val string) Updater {
	return func(r *RawConfigMode, typ ModeType) error {
		if field != FieldAdminUserIds {
			return errors.New(string(field) + " is not a []string field")
		}
		var newList []string
		for _, rec := range r.AdminUserIds {
			if rec == val {
				continue
			}
			newList = append(newList, rec)
		}
		r.AdminUserIds = newList
		return nil
	}
}