Skip to content

Commit

Permalink
Updated updater based on PR feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
mickgmdb committed Feb 18, 2024
1 parent bc1387f commit 557e5a4
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions _automation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
Expand Down Expand Up @@ -415,25 +414,6 @@ func (s *UpdateService) downloadYaml(ctx context.Context, g *Grammar) {
_ = os.WriteFile(fmt.Sprintf("%s/scanner.cc", g.Language), b, 0644)
}

// updateFileContents reads a file and replaces include directives with corrected paths.
func updateFileContents(filePath string) error {
input, err := ioutil.ReadFile(filePath)
if err != nil {
return err
}

lines := strings.Split(string(input), "\n")
for i, line := range lines {
if strings.Contains(line, `<tree_sitter/`) {
lines[i] = strings.Replace(line, `<tree_sitter/`, `<`, 1)
} else if strings.Contains(line, `"tree_sitter/`) {
lines[i] = strings.Replace(line, `"tree_sitter/`, `"`, 1)
}
}
output := strings.Join(lines, "\n")
return ioutil.WriteFile(filePath, []byte(output), 0644)
}

func logAndExit(logger *Logger, msg string, args ...interface{}) {
logger.Error(msg, args...)
os.Exit(1)
Expand Down

0 comments on commit 557e5a4

Please sign in to comment.