schema/parser.go
func LoadFile(filename string, parser Parser) (Package, error) {
    file, err := os.Open(filename)
    if err != nil {
        return Package{}, err
    }
    defer file.Close()

    // read file
    bytes, err := ioutil.ReadAll(file)
    if err != nil {
        return Package{}, err
    }

    // convert to string and load
    return parser.Parse(file.Name(), string(bytes))
}
func LoadFile(filename string, parser Parser) (Package, error) {
    file, err := os.Open(filename)
    if err != nil {
        return Package{}, err
    }
    defer file.Close()

    // read file
    bytes, err := ioutil.ReadAll(file)
    if err != nil {
        return Package{}, err
    }

    // convert to string and load
    return parser.Parse(file.Name(), string(bytes))
}
// LoadFile reads a schema document from a file.