MCPcopy Index your code
hub / github.com/mislav/hub / readContentsFromFile

Function readContentsFromFile

github/template.go:69–81  ·  view source on GitHub ↗
(filename string)

Source from the content-addressed store, hash-verified

67}
68
69func readContentsFromFile(filename string) (contents string, err error) {
70 content, err := ioutil.ReadFile(filename)
71 if err != nil {
72 if strings.HasSuffix(err.Error(), " is a directory") {
73 err = nil
74 }
75 return
76 }
77
78 contents = strings.Replace(string(content), "\r\n", "\n", -1)
79 contents = strings.TrimSuffix(contents, "\n")
80 return
81}

Callers 1

ReadTemplateFunction · 0.85

Calls 2

ReplaceMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…