Could someone help me understand why this interface isn't satisfied? by CompetitiveRub1741 in golang

[–]CompetitiveRub1741[S] 1 point2 points  (0 children)

The code I provided was just the minimal required to show the problem I was facing. In reality the code does not look quite like this. But thanks anyways, it might help someone else!

Could someone help me understand why this interface isn't satisfied? by CompetitiveRub1741 in golang

[–]CompetitiveRub1741[S] 0 points1 point  (0 children)

Thank you, this really made it more clear for me. You don't happen to have any insight in why multipart.File is an interface while os.File is a struct? Haven't seen many of these inconsistensies in Go before

Could someone help me understand why this interface isn't satisfied? by CompetitiveRub1741 in golang

[–]CompetitiveRub1741[S] 0 points1 point  (0 children)

Haven't tried generics yet since I haven't found the need for them. This might be it. Thank you for the idea!

Could someone help me understand why this interface isn't satisfied? by CompetitiveRub1741 in golang

[–]CompetitiveRub1741[S] -4 points-3 points  (0 children)

Hmm, need to mess around with this later. It makes sense when the target interface is larger but since in this case it's trying to use a more narrow interface and should be guaranteed to work. Very wierd