uber-go / dig

A reflection based dependency injection toolkit for Go.
https://go.uber.org/dig
MIT License
3.88k stars 206 forks source link

Add suggestions for slices and array element missing types #390

Closed paullen closed 1 year ago

paullen commented 1 year ago

Changes:

Added suggestions for requesting slice/array of pointers instead of the elements and vice versa

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

paullen commented 1 year ago

Hey. Just wanted to follow up on this PR. This seems like a good suggestion to have, it is a part of the solution for Issue #184 . Then there is the issue #389 that addresses the other half of the #184 issue.

JacobOaks commented 1 year ago

Hey @paullen, thanks for this PR!

I think this is a good addition, can we just add a test case similar to this one that tests that the suggestions get properly populated into an error from a call to fx.Invoke?

paullen commented 1 year ago

@JacobOaks Added test cases, the test coverage is now 99%, up from 98.3%. Please review. Thanks!

codecov[bot] commented 1 year ago

Codecov Report

Merging #390 (a5d35dc) into master (a30081d) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #390      +/-   ##
==========================================
+ Coverage   98.39%   98.40%   +0.01%     
==========================================
  Files          22       22              
  Lines        1492     1502      +10     
==========================================
+ Hits         1468     1478      +10     
  Misses         15       15              
  Partials        9        9              
Files Changed Coverage Δ
error.go 100.00% <100.00%> (ø)

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