kcl-lang / kcl-go

KCL Go SDK
https://pkg.go.dev/kcl-lang.io/kcl-go@main
Apache License 2.0
52 stars 26 forks source link

Fix native API call on error inside `kclvm_service_call_with_length` #274

Closed bozaro closed 7 months ago

bozaro commented 7 months ago

1. Does this PR affect any open issues?(Y/N) and add issue references:

Fix #260, again

2. What is the scope of this PR (e.g. component or file name):

pkg/native

3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

KCL method kclvm_service_call_with_length don't change result_len on negative scenario: https://github.com/kcl-lang/kcl/blob/d6ba71a3118b8756bf85d29f8ac221052f893ded/kclvm/api/src/service/capi.rs#L155-L162

And returns pointer to error CString pointer without touching result_len. I set result_len to C.SIZE_MAX (zero is correct protobuf message size) as CString with error marker and always return error if result_len was unchanged.

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

coveralls commented 7 months ago

Pull Request Test Coverage Report for Build 8566803616

Details


Totals Coverage Status
Change from base Build 8481575698: 0.04%
Covered Lines: 3174
Relevant Lines: 5152

💛 - Coveralls
Peefy commented 7 months ago

LGTM