-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document Usage in go:generate Directives #66
Comments
Thanks, this very good point! Just curious, if we do something like this Would be easier? 🤔 You are right documenting this would be awesome, help / PRs wanted! 🤗 |
@bwplotka While this might work for flat projects, I think for nested packages it might not work. I'm pretty sure Moreover,
and |
Right (: Then: |
Alternatively |
Would it be a good idea to implement a tempdir=$(mktemp)
env GOBIN=${tempdir} \
bingo get -l
env PATH=${GOBIN}:${PATH} \
go generate [ARGS] |
That might work, what's wrong with adding this to your Makefile / script? 🤔 I might think there is no need to add a separate bingo command for such a simple flow. We can add that to documentation too (: |
That makes sense. I've tried the Makefile approach and it worked great. On the other hand, |
Please do! Thanks (:
Kind Regards,
Bartek Płotka ***@***.***)
…On Tue, Jun 15, 2021 at 7:36 PM Jesús García Crespo < ***@***.***> wrote:
That makes sense. I've tried the Makefile approach and it worked great. On
the other hand, //go:generate source ... && ... didn't work but I should
try again. It'd be nice if users could start using bingo out of the box
without this extra level of indirection, e.g. this snippet
<https://github.com/vmware-tanzu/octant/blob/a7e566c54573ab9ae5991b785edad93f5d61e6e3/internal/cluster/cluster.go#L42-L51>,
it'd be a lot of work to make that work.
In any case, I think that you've suggested a good compromise. I'd be happy
to put some docs together.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVA3O4TYLRAS7LZK7Y2CQLTS6FRHANCNFSM4WKOTA4A>
.
|
In my Go project, I have some go generate directives that look like this:
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
Unfortunately, this bypasses bingo's installation and pinning process. After a bunch of trial and error, I discovered that you can use use use the bingo-pinned version of the tool like so:
Makefile:
Source Code:
//go:generate $COUNTERFEITER -generate
This might be a bit of a hack, but I wasn't able to find any other examples of using bingo tools in go:generate directives. This might be worth documenting for others who want to use bingo for their code-generation tools.
The text was updated successfully, but these errors were encountered: