MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / sha256File

Function sha256File

cmd/sqlc-test-setup/main.go:290–302  ·  view source on GitHub ↗

sha256File computes the SHA256 hash of a file and returns the hex string.

(path string)

Source from the content-addressed store, hash-verified

288
289// sha256File computes the SHA256 hash of a file and returns the hex string.
290func sha256File(path string) (string, error) {
291 f, err := os.Open(path)
292 if err != nil {
293 return "", err
294 }
295 defer f.Close()
296
297 h := sha256.New()
298 if _, err := io.Copy(h, f); err != nil {
299 return "", err
300 }
301 return hex.EncodeToString(h.Sum(nil)), nil
302}
303
304func installMySQL() error {
305 log.Println("--- Installing MySQL 9 ---")

Callers 1

installPostgreSQLFunction · 0.85

Calls 2

OpenMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected