Skip to content
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

Add support for getting info from Invoke statements #383

Merged
merged 7 commits into from
Apr 24, 2023

Conversation

manjari25
Copy link
Contributor

@manjari25 manjari25 commented Apr 14, 2023

This commit exposes InvokeInfo and FillInvokeInfo to help users extract the types requested by an Invoke statement.

Example usage -

var info InvokeInfo
c.Invoke(func(typ1 type1, typ2 type2){}, FillInvokeInfo(&info))

// Will print the types requested by the Invoke statement
for _, typ := range info.ReqTypes {
    fmt.Println(typ) 
}

Refs: GO-669

@codecov
Copy link

codecov bot commented Apr 14, 2023

Codecov Report

Merging #383 (a3f32f6) into master (87cf89e) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #383      +/-   ##
==========================================
+ Coverage   98.35%   98.36%   +0.01%     
==========================================
  Files          21       21              
  Lines        1458     1471      +13     
==========================================
+ Hits         1434     1447      +13     
  Misses         15       15              
  Partials        9        9              
Impacted Files Coverage Δ
invoke.go 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@manjari25 manjari25 marked this pull request as ready for review April 14, 2023 20:05
Copy link
Contributor

@JacobOaks JacobOaks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@manjari25 manjari25 requested review from sywhang and abhinav April 19, 2023 23:56
@manjari25 manjari25 marked this pull request as draft April 20, 2023 01:19
Copy link
Collaborator

@abhinav abhinav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New API looks and the implementation looks fine.

invoke.go Outdated
}

// FillInvokeInfo is an InvokeOption that writes info on the types requested
// by the Invoke function into the specified InvokeInfo.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "accepted by the Invoke function"

@manjari25 manjari25 marked this pull request as ready for review April 21, 2023 15:25
@manjari25 manjari25 requested a review from sywhang April 21, 2023 15:25
Copy link
Contributor

@sywhang sywhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@tchung1118 tchung1118 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From group code review

@manjari25 manjari25 merged commit 297a20c into master Apr 24, 2023
@manjari25 manjari25 deleted the manjari25/InvokeInfo branch April 24, 2023 17:50
alexisvisco pushed a commit to alexisvisco/dig that referenced this pull request Aug 31, 2023
This commit exposes InvokeInfo and FillInvokeInfo to help users extract the types requested by an Invoke statement.

Example usage -

var info InvokeInfo
c.Invoke(func(typ1 type1, typ2 type2){}, FillInvokeInfo(&info))

// Will print the types requested by the Invoke statement
for _, typ := range info.ReqTypes {
    fmt.Println(typ)
}

Refs: GO-669
@alexisvisco
Copy link

@JacobOaks just to say that I have added outputs in the invoke information #395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants