- 
                Notifications
    
You must be signed in to change notification settings  - Fork 186
 
Remove dependency to dapr dapr #751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
and remove dependency with dapr/dapr. Signed-off-by: Tiago Scolari <tiago@diagrid.io>
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
6ab22d8    to
    97ae38a      
    Compare
  
    
          Codecov ReportAttention: Patch coverage is  
 
 Additional details and impacted files@@             Coverage Diff             @@
##             main     #751       +/-   ##
===========================================
- Coverage   62.52%   23.53%   -39.00%     
===========================================
  Files          56       64        +8     
  Lines        4139    10977     +6838     
===========================================
- Hits         2588     2583        -5     
- Misses       1425     8257     +6832     
- Partials      126      137       +11     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
eb95687    to
    d4aabde      
    Compare
  
    Signed-off-by: Tiago Scolari <tiago@diagrid.io>
d4aabde    to
    cb02db4      
    Compare
  
    | 
           Ideally codecov should exclude the generated path   | 
    
2780d32    to
    eb79c3c      
    Compare
  
    Signed-off-by: Tiago Scolari <tiago@diagrid.io>
eb79c3c    to
    cf22f27      
    Compare
  
    Signed-off-by: Tiago Scolari <tiago@diagrid.io>
| 
           I take it buf is a direct replacement for protoc? I don't have any major opinion either way but I'm not sure how generating them in the SDK is making it less prohibitive to updates with breaking changes to protos. Sure - the protos are intended as a source of truth but even as highlighted by the PR it would potentially involve changes and code sprawl that goes unmaintained in the future where buf is not maintaining the added package. I'm actually for a clear contract with the runtime regarding exposed APIs so if a proposal can be drawn up with how this works out going forwards especially with the other SDKs considered I'd like to see this progressed. Is there a plan on making use of buf to the fullest extent replacing some existing tooling/actions? Perhaps generating all the protos in a separate repository - ignoring the code sprawl aspect might be something to consider also  | 
    
          
 
 I think ideally protos would be generated by CI, I can add this to the proposal here. It could work similar to the go.mod tidy checks, where if they are not up to date the check would fail. This would keep them in sync. 
 I think this is probably the behavior of the other SDKs at the moment, since they can't consume the compiled go code from the dapr/dapr, For example the python sdk here - although I couldn't find how they build them. If it is less of a change I could try to remove buf in favor of protoc directly 🤔  | 
    
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
98634e9    to
    af653b4      
    Compare
  
    Because dapr/dapr is not registered in the buf registry we can't leverage of it's version locking capability. This should make it safe to only pull new changes when desired for now. Signed-off-by: Tiago Scolari <tiago@diagrid.io>
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
5d79a86    to
    ad22dfc      
    Compare
  
    | 
           No, I'm actually pretty pro-using the best tool for the job and if buf is the new spanner of the day all is good. Indeed most other SDKs have a script of some sort that pull a specified sha or tag and compile using protoc, this hasn't been ideal in most cases. Importing dapr/dapr has been the best way forward without having to manage protos but I just would like to see a path for migration clearly defined. E.g. can the helper functions be eliminated so we're left with a clear API surface?  | 
    
Signed-off-by: Tiago Scolari <tiago@diagrid.io>
| 
           Cool! Yeah, I think buf does simplify things a lot. We could get rid of the helper functions I think, but I let make a counter argument first: I think the contract right now is still at the API surface already, what those helpers are currently doing is using generics to simplify setting/fetching some properties of the raw/generated  Initially I was worried that the modified types would have leaked to the sdk consumers, but they are only used internally, that's why it was easy to work around with the functions. Just to get to my point, we can remove the functions, but we would still need code that makes it easier for example to set the Payload on 4 different types of objects. The helper methods is an approach using generics, I think other options would be to create some sort of decorator for them, but in the end they all would be doing the same thing. In a nutshell what they are doing is mostly things like before sending or after fetching a response through the API (where x can be 4 different types).  | 
    
| 
           I've created an issue on   | 
    
| 
           I think this should wait until a general consensus is reached with other SDK maintainers before we go full steam ahead with this change.  | 
    
| .PHONY: proto-update | ||
| proto-update: | ||
| @echo "Updating Dapr to latest commit..." | ||
| @git ls-remote https://github.com/dapr/dapr.git HEAD | cut -f1 > .dapr-proto-ref | ||
| @echo "Updated .dapr-proto-ref to: $$(cat .dapr-proto-ref)" | ||
| @$(MAKE) proto | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see a git tag or hash passed here ideally
Description
This is an attempt to remove the dependency between go-sdk and dapr/dapr.
It's a big limitation that an go application using the go-sdk also needs to bring in the dapr/dapr codebase, just for the use of protos. In more complex systems, this causes the dependency link between them to be prohibitive to updates, causing a chain reaction upon a version bump - it's also not nice to have such a big dependency in any project just to consume generated code.
The main goal of this change is to generate the used dapr/dapr protos in the go-sdk repo, and remove any code dependency with the dapr/dapr repo.
For that, a new make target
make protowas added. It uses buf to fetch the dapr/dapr at compile time and generate the necessary protos.There are "hand made" changes to the compiled protos in the dapr/dapr repo that were being used by the go-sdk.
To get around those, a new
client/internal/cryptopackage was added, and instead of injecting methods to generated types it just uses generics to achieve the same results.** Update 1:**
Issue reference
#749
Please reference the issue this PR will close: #749
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: