From 5da388521510b839406b6232748bc669cda97dec Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Sun, 7 Aug 2022 00:59:50 +0900 Subject: Upgrade Go compiler to v1.19 --- cmd/vartan/compile.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'cmd/vartan/compile.go') diff --git a/cmd/vartan/compile.go b/cmd/vartan/compile.go index eb25374..49e383d 100644 --- a/cmd/vartan/compile.go +++ b/cmd/vartan/compile.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "os" "path/filepath" @@ -67,13 +66,13 @@ func runCompile(cmd *cobra.Command, args []string) (retErr error) { return err } - src, err := ioutil.ReadAll(os.Stdin) + src, err := io.ReadAll(os.Stdin) if err != nil { return err } grmPath = filepath.Join(tmpDirPath, "stdin.vartan") - err = ioutil.WriteFile(grmPath, src, 0600) + err = os.WriteFile(grmPath, src, 0600) if err != nil { return err } @@ -135,14 +134,14 @@ func readGrammar(path string) (grm *grammar.Grammar, retErr error) { // writeCompiledGrammarAndReport writes a compiled grammar and a report to a files located at a specified path. // This function selects one of the following output methods depending on how the path is specified. // -// 1. When the path is a directory path, this function writes the compiled grammar and the report to -// /.json and /-report.json files, respectively. -// -report.json as the output files. -// 2. When the path is a file path or a non-exitent path, this function asumes that the path represents a file -// path for the compiled grammar. Then it also writes the report in the same directory as the compiled grammar. -// The report file is named .json. -// 3. When the path is an empty string, this function writes the compiled grammar to the stdout and writes -// the report to a file named /-report.json. +// 1. When the path is a directory path, this function writes the compiled grammar and the report to +// /.json and /-report.json files, respectively. +// -report.json as the output files. +// 2. When the path is a file path or a non-exitent path, this function asumes that the path represents a file +// path for the compiled grammar. Then it also writes the report in the same directory as the compiled grammar. +// The report file is named .json. +// 3. When the path is an empty string, this function writes the compiled grammar to the stdout and writes +// the report to a file named /-report.json. func writeCompiledGrammarAndReport(cgram *spec.CompiledGrammar, report *spec.Report, path string) error { cgramPath, reportPath, err := makeOutputFilePaths(cgram.Name, path) if err != nil { -- cgit v1.2.3