bradfitz / go-issue-mirror

[old] precursor to golang.org/x/build/maintner/godata
24 stars 2 forks source link

issues: Simpler implementation of import path to absolute dir resolution. #2

Closed dmitshur closed 8 years ago

dmitshur commented 8 years ago

I needed this functionality quite often in many packages, so over time I've come down to this solution. It uses go/build.Import with build.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.

dmitshur commented 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).

bradfitz commented 8 years ago

Oh, right. That's better. I copy/pasted some ancient code of mine.

dmitshur commented 8 years ago

Gotcha, thanks!