(ctx context.Context)
| 51 | } |
| 52 | |
| 53 | func (r *Runner) loadAndCompile(ctx context.Context) (*runtimeAndCode, error) { |
| 54 | expected, err := r.getChecksum(ctx) |
| 55 | if err != nil { |
| 56 | return nil, err |
| 57 | } |
| 58 | cacheDir, err := cache.PluginsDir() |
| 59 | if err != nil { |
| 60 | return nil, err |
| 61 | } |
| 62 | value, err, _ := flight.Do(expected, func() (interface{}, error) { |
| 63 | return r.loadAndCompileWASM(ctx, cacheDir, expected) |
| 64 | }) |
| 65 | if err != nil { |
| 66 | return nil, err |
| 67 | } |
| 68 | data, ok := value.(*runtimeAndCode) |
| 69 | if !ok { |
| 70 | return nil, fmt.Errorf("returned value was not a compiled module") |
| 71 | } |
| 72 | return data, nil |
| 73 | } |
| 74 | |
| 75 | func (r *Runner) fetch(ctx context.Context, uri string) ([]byte, string, error) { |
| 76 | var body io.ReadCloser |
no test coverage detected