Use go/build to determine the package name.

This works correctly for packages with import paths ending in go-foo or foo.go but with an actual name of foo, or any other case where the package name does not match the import path.

In my usage I haven't found it to be perceivably slower than the naive path.Base method from before.