func (f *File) Reload() error {
	u.Logf(u.Debug, "Reloading file '%v'", f.Filename)
	content, err := ioutil.ReadFile(f.Path)
	if err != nil {
		return err
	}
	info, err := os.Stat(f.Path)
	if err != nil {
		return err
	}
	f.Content = content
	f.ModTime = info.ModTime()
	f.Size = info.Size()
	return nil
}
Reload - Reloads this file returning error if read failed or failed
to read metadata
package file
import (
	"github.com/gomarkdown/markdown"
	diff "github.com/sergi/go-diff/diffmatchpatch"
	"gomd/mdserver/highlight"
	u "gomd/util"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"time"
)
const (
	Markdown   = ".md"
	Go         = ".go"
	Rust       = ".rs"
	Shell      = ".sh"
	Python     = ".py"
	C          = ".c"
	CPP        = ".cpp"
	JavaScript = ".js"
	Java       = ".java"
	Ruby       = ".rb"
	YAML       = ".yaml"
	JSON       = ".json"
)
type Language struct {
	Name string
}
func NewLanguage(extension string) *Language {
	switch extension {
	case Markdown:
		return &Language{"markdown"}
	case Go:
		return &Language{"go"}
	case Rust:
		return &Language{"rust"}
	case Shell:
		return &Language{"shell"}
	case C:
		return &Language{"c"}
	case CPP:
		return &Language{"cpp"}
	case JavaScript:
		return &Language{"javascript"}
	case Java:
		return &Language{"java"}
	case Ruby:
		return &Language{"ruby"}
	case YAML:
		return &Language{"yaml"}
	case JSON:
		return &Language{"json"}
	}
	return &Language{""}
}
func (l *Language) Highlight(code, style string) (string, error) {
	return highlight.HighlightCode(code, l.Name, style)
}
type File struct {
	ModTime        time.Time
	Path           string
	Filename       string
	Size           int64
	InitialContent string
	Lang           *Language
	Content        []byte
}
func NewFile(path string) (File, error) {
	content, err := ioutil.ReadFile(path)
	if err != nil {
		return File{}, err
	}
	info, err := os.Stat(path)
	if err != nil {
		return File{}, err
	}
	_, file := filepath.Split(path)
	return File{
		ModTime:        info.ModTime(),
		Path:           path,
		Filename:       file,
		Size:           info.Size(),
		Lang:           NewLanguage(u.FileExtension(info)),
		InitialContent: string(content),
		Content:        content,
	}, nil
}