clipperhouse/gen

typewriters require build pkg files, not just source

maddyblue opened this issue · 2 comments

New typewriter gen requires that there are build package files (.a files in $GOPATH/pkg) to run. Otherwise it panics: "panic: tsdb.go:21:2: could not import github.com/StackExchange/slog (can't find import: github.com/StackExchange/slog)".

Reproduce by rm -rf $GOPATH/pkg. Run gen to see the error. Then go install . in whatever the missing package was. Rerun gen to see it work.

That appears to be an artifact of using local paths for packages? Maybe? I’ve pushed a change which removes those from gen.main, see if you can still repro?

I’ll consider this an edge case for now, keeping an eye open. If the package on which the user is running gen has built recently, those .a files (representing external dependencies) should be available.

Changes to the current package – adding gen comments, eg – should be no problem, since gen parses the AST of the package from source, then uses the types pkg to make sense of type information. The latter requires the .a files, but not the former.

So I think (hope) that normal workflows will not experience this issue.