Closed dmitshur closed 8 years ago
@bradfitz Have you had a chance to see and review this PR for issues
package? If you did and didn't think it was an improvement worth merging, we can close this (I'd be curious to hear your rationale, so I can make my code better).
Oh, right. That's better. I copy/pasted some ancient code of mine.
Gotcha, thanks!
I needed this functionality quite often in many packages, so over time I've come down to this solution. It uses
go/build.Import
withbuild.FindOnly
flag. Given Go 1 promise, I think it's safe to rely on that behavior and there's no need to reimplement it from scratch.It seems to be functionally equivalent to the previous code, but much shorter, simpler and easier to maintain.
This is an optional suggestion PR. I think it's a net improvement, but you're welcome to use your judgement and close this if you don't think it's an improvement.