func (m Mod) Write() (string, string, error) {
	f, err := os.Create(m.metaFile)
	if err != nil {
		err2 := os.MkdirAll(filepath.Dir(m.metaFile), os.ModePerm)
		if err2 == nil {
			f, err = os.Create(m.metaFile)
		}
		if err != nil {
			return "sha256", "", err
		}
	}
	h, err := GetHashImpl("sha256")
	if err != nil {
		_ = f.Close()
		return "", "", err
	}
	w := io.MultiWriter(h, f)
	enc := toml.NewEncoder(w)
	enc.Indent = ""
	err = enc.Encode(m)
	hashString := hex.EncodeToString(h.Sum(nil))
	if err != nil {
		_ = f.Close()
		return "sha256", hashString, err
	}
	return "sha256", hashString, f.Close()
}
Write saves the mod file, returning a hash format and the value of the hash of the saved file
package core
import (
	"encoding/hex"
	"errors"
	"fmt"
	"io"
	"net/http"
	"os"
	"path/filepath"
	"strconv"
	"github.com/BurntSushi/toml"
)
type Mod struct {
	metaFile string       
	Name     string      `toml:"name"`
	FileName string      `toml:"filename"`
	Side     string      `toml:"side,omitempty"`
	Download ModDownload `toml:"download"`
	Update     map[string]map[string]interface{} `toml:"update"`
	updateData map[string]interface{}
	Option *struct {
		Optional    bool   `toml:"optional"`
		Description string `toml:"description,omitempty"`
		Default     bool   `toml:"default,omitempty"`
	} `toml:"option,omitempty"`
}
type ModDownload struct {
	URL        string `toml:"url"`
	HashFormat string `toml:"hash-format"`
	Hash       string `toml:"hash"`
}
const (
	ServerSide    = "server"
	ClientSide    = "client"
	UniversalSide = "both"
)
func LoadMod(modFile string) (Mod, error) {
	var mod Mod
	if _, err := toml.DecodeFile(modFile, &mod); err != nil {
		return Mod{}, err
	}
	mod.updateData = make(map[string]interface{})
	for k, v := range mod.Update {
		updater, ok := Updaters[k]
		if ok {
			updateData, err := updater.ParseUpdate(v)
			if err != nil {
				return mod, err
			}
			mod.updateData[k] = updateData
		} else {
			return mod, errors.New("Update plugin " + k + " not found!")
		}
	}
	mod.metaFile = modFile
	return mod, nil
}
func (m *Mod) SetMetaName(metaName string, index Index) string {
	m.metaFile = ResolveMod(metaName, index)
	return m.metaFile
}