Verify the provided sha256 is valid.
(ctx context.Context)
| 38 | |
| 39 | // Verify the provided sha256 is valid. |
| 40 | func (r *Runner) getChecksum(ctx context.Context) (string, error) { |
| 41 | if r.SHA256 != "" { |
| 42 | return r.SHA256, nil |
| 43 | } |
| 44 | // TODO: Add a log line here about something |
| 45 | _, sum, err := r.fetch(ctx, r.URL) |
| 46 | if err != nil { |
| 47 | return "", err |
| 48 | } |
| 49 | slog.Warn("fetching WASM binary to calculate sha256. Set this value in sqlc.yaml to prevent unneeded work", "sha256", sum) |
| 50 | return sum, nil |
| 51 | } |
| 52 | |
| 53 | func (r *Runner) loadAndCompile(ctx context.Context) (*runtimeAndCode, error) { |
| 54 | expected, err := r.getChecksum(ctx) |