( ctx context.Context, protoFileRef buffetch.ProtoFileRef, functionOptions *functionOptions, )
| 976 | } |
| 977 | |
| 978 | func (c *controller) getWorkspaceForProtoFileRef( |
| 979 | ctx context.Context, |
| 980 | protoFileRef buffetch.ProtoFileRef, |
| 981 | functionOptions *functionOptions, |
| 982 | ) (_ bufworkspace.Workspace, retErr error) { |
| 983 | if len(functionOptions.targetPaths) > 0 { |
| 984 | // Even though we didn't have an explicit error case, this never actually worked |
| 985 | // properly in the pre-refactor buf CLI. We're going to call it unusable and this |
| 986 | // not a breaking change - if anything, this is a bug fix. |
| 987 | // TODO FUTURE: Feed flag names through to here. |
| 988 | return nil, fmt.Errorf("--path is not valid for use with .proto file references") |
| 989 | } |
| 990 | if len(functionOptions.targetExcludePaths) > 0 { |
| 991 | // Even though we didn't have an explicit error case, this never actually worked |
| 992 | // properly in the pre-refactor buf CLI. We're going to call it unusable and this |
| 993 | // not a breaking change - if anything, this is a bug fix. |
| 994 | // TODO FUTURE: Feed flag names through to here. |
| 995 | return nil, fmt.Errorf("--exclude-path is not valid for use with .proto file references") |
| 996 | } |
| 997 | readBucketCloser, bucketTargeting, err := c.buffetchReader.GetSourceReadBucketCloser( |
| 998 | ctx, |
| 999 | c.container, |
| 1000 | protoFileRef, |
| 1001 | functionOptions.getGetReadBucketCloserOptions()..., |
| 1002 | ) |
| 1003 | if err != nil { |
| 1004 | return nil, err |
| 1005 | } |
| 1006 | defer func() { |
| 1007 | retErr = errors.Join(retErr, readBucketCloser.Close()) |
| 1008 | }() |
| 1009 | options := []bufworkspace.WorkspaceBucketOption{ |
| 1010 | bufworkspace.WithProtoFileTargetPath( |
| 1011 | protoFileRef.ProtoFilePath(), |
| 1012 | protoFileRef.IncludePackageFiles(), |
| 1013 | ), |
| 1014 | bufworkspace.WithConfigOverride( |
| 1015 | functionOptions.configOverride, |
| 1016 | ), |
| 1017 | } |
| 1018 | if functionOptions.ignoreAndDisallowV1BufWorkYAMLs { |
| 1019 | options = append( |
| 1020 | options, |
| 1021 | bufworkspace.WithIgnoreAndDisallowV1BufWorkYAMLs(), |
| 1022 | ) |
| 1023 | } |
| 1024 | return c.workspaceProvider.GetWorkspaceForBucket( |
| 1025 | ctx, |
| 1026 | readBucketCloser, |
| 1027 | bucketTargeting, |
| 1028 | options..., |
| 1029 | ) |
| 1030 | } |
| 1031 | |
| 1032 | func (c *controller) getWorkspaceForSourceRef( |
| 1033 | ctx context.Context, |
no test coverage detected