The issue is that, if pkger.go is created (empty) before the go list -json call it will fail and give the generic directory name instead of the
actual package name under the directory. This is fine in most cases,
except when the package name differs from the directory name - which is
allowed. Then pkger.go will conflict and fail to compile with the rest
of *.go under the same directory.
To fix, we simply obtain the real package name before creating the dummy
pkger.go file and then pass the name into the file.
The issue is that, if pkger.go is created (empty) before the
go list -json
call it will fail and give the generic directory name instead of the actual package name under the directory. This is fine in most cases, except when the package name differs from the directory name - which is allowed. Then pkger.go will conflict and fail to compile with the rest of *.go under the same directory.To fix, we simply obtain the real package name before creating the dummy pkger.go file and then pass the name into the file.