MCPcopy
hub / github.com/syncthing/syncthing / readAll

Function readAll

script/copyrights.go:252–265  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

250}
251
252func readAll(path string) []byte {
253 fd, err := os.Open(path)
254 if err != nil {
255 log.Fatal(err)
256 }
257 defer fd.Close()
258
259 bs, err := io.ReadAll(fd)
260 if err != nil {
261 log.Fatal(err)
262 }
263
264 return bs
265}
266
267func writeFile(path string, data string) {
268 err := os.WriteFile(path, []byte(data), 0o644)

Callers 1

mainFunction · 0.85

Calls 3

FatalMethod · 0.80
OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected