From 611fb8a865fcba05a7c4738a36c2ee7b75cdb85f Mon Sep 17 00:00:00 2001 From: c0re100 Date: Thu, 27 Jan 2022 05:05:22 +0800 Subject: [PATCH] Local tl parser --- cmd/generate-code.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/generate-code.go b/cmd/generate-code.go index feded19..a4a304f 100644 --- a/cmd/generate-code.go +++ b/cmd/generate-code.go @@ -4,7 +4,6 @@ import ( "bufio" "flag" "log" - "net/http" "os" "path/filepath" @@ -33,14 +32,13 @@ func main() { flag.Parse() - resp, err := http.Get("https://raw.githubusercontent.com/tdlib/td/" + config.version + "/td/generate/scheme/td_api.tl") + tl, err := os.Open("./data/td_api.tl") if err != nil { - log.Fatalf("http.Get error: %s", err) + log.Fatalf(err.Error()) return } - defer resp.Body.Close() - schema, err := tlparser.Parse(resp.Body) + schema, err := tlparser.Parse(bufio.NewReader(tl)) if err != nil { log.Fatalf("schema parse error: %s", err) return