package shared import ( "bytes" "io" "io/fs" "os" "github.com/goccy/go-json" ) func LoadJSONFileFS(fsys fs.FS, fileName string, value interface{}) error { file, err := fs.ReadFile(fsys, fileName) if err != nil { return err } fileBuffer := bytes.NewReader(file) if err := json.NewDecoder(fileBuffer).Decode(&value); err != nil && err != io.EOF { return err } clear(file) return nil } func LoadJSONFile(fileName string, value interface{}) error { file, err := os.ReadFile(fileName) if err != nil { return err } fileBuffer := bytes.NewReader(file) if err := json.NewDecoder(fileBuffer).Decode(&value); err != nil && err != io.EOF { return err } clear(file) return nil }