( ctx context.Context, ref buffetch.Ref, functionOptions *functionOptions, )
| 925 | } |
| 926 | |
| 927 | func (c *controller) getImageForRef( |
| 928 | ctx context.Context, |
| 929 | ref buffetch.Ref, |
| 930 | functionOptions *functionOptions, |
| 931 | ) (bufimage.Image, error) { |
| 932 | switch t := ref.(type) { |
| 933 | case buffetch.ProtoFileRef: |
| 934 | workspace, err := c.getWorkspaceForProtoFileRef(ctx, t, functionOptions) |
| 935 | if err != nil { |
| 936 | return nil, err |
| 937 | } |
| 938 | return c.getImageForWorkspace(ctx, workspace, functionOptions) |
| 939 | case buffetch.SourceRef: |
| 940 | workspace, err := c.getWorkspaceForSourceRef(ctx, t, functionOptions) |
| 941 | if err != nil { |
| 942 | return nil, err |
| 943 | } |
| 944 | return c.getImageForWorkspace(ctx, workspace, functionOptions) |
| 945 | case buffetch.ModuleRef: |
| 946 | workspace, err := c.getWorkspaceForModuleRef(ctx, t, functionOptions) |
| 947 | if err != nil { |
| 948 | return nil, err |
| 949 | } |
| 950 | return c.getImageForWorkspace(ctx, workspace, functionOptions) |
| 951 | case buffetch.MessageRef: |
| 952 | return c.getImageForMessageRef(ctx, t, functionOptions) |
| 953 | default: |
| 954 | // This is a system error. |
| 955 | return nil, syserror.Newf("invalid Ref: %T", ref) |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | func (c *controller) getImageForWorkspace( |
| 960 | ctx context.Context, |
no test coverage detected