MCPcopy
hub / github.com/apache/devlake / firstLineFromFile

Function firstLineFromFile

backend/core/migration/linter/main.go:43–55  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

41}
42
43func firstLineFromFile(path string) string {
44 inFile, err := os.Open(path)
45 if err != nil {
46 panic(err)
47 }
48 defer inFile.Close()
49
50 scanner := bufio.NewScanner(inFile)
51 for scanner.Scan() {
52 return scanner.Text()
53 }
54 panic(fmt.Errorf("empty file: " + path))
55}
56
57const (
58 LINT_ERROR = "error"

Callers 1

initFunction · 0.85

Calls 2

CloseMethod · 0.65
ScanMethod · 0.65

Tested by

no test coverage detected