( ctx context.Context, logger *slog.Logger, storageosProvider storageos.Provider, container app.EnvStderrContainer, images []bufimage.Image, pluginName string, pluginInfo *pluginInfo, )
| 41 | } |
| 42 | |
| 43 | func executePlugin( |
| 44 | ctx context.Context, |
| 45 | logger *slog.Logger, |
| 46 | storageosProvider storageos.Provider, |
| 47 | container app.EnvStderrContainer, |
| 48 | images []bufimage.Image, |
| 49 | pluginName string, |
| 50 | pluginInfo *pluginInfo, |
| 51 | ) (*pluginpb.CodeGeneratorResponse, error) { |
| 52 | generator := bufprotopluginexec.NewGenerator( |
| 53 | logger, |
| 54 | storageosProvider, |
| 55 | ) |
| 56 | requests, err := bufimage.ImagesToCodeGeneratorRequests( |
| 57 | images, |
| 58 | strings.Join(pluginInfo.Opt, ","), |
| 59 | bufprotopluginexec.DefaultVersion, |
| 60 | false, |
| 61 | false, |
| 62 | ) |
| 63 | if err != nil { |
| 64 | return nil, err |
| 65 | } |
| 66 | var options []bufprotopluginexec.GenerateOption |
| 67 | if pluginInfo.Path != "" { |
| 68 | options = append(options, bufprotopluginexec.GenerateWithPluginPath(pluginInfo.Path)) |
| 69 | } |
| 70 | response, err := generator.Generate( |
| 71 | ctx, |
| 72 | container, |
| 73 | pluginName, |
| 74 | requests, |
| 75 | options..., |
| 76 | ) |
| 77 | if err != nil { |
| 78 | return nil, fmt.Errorf("--%s_out: %v", pluginName, err) |
| 79 | } |
| 80 | return response, nil |
| 81 | } |
no test coverage detected
searching dependent graphs…