Skip to content
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

grapi build server fails #235

Open
potsbo opened this issue May 7, 2020 · 0 comments
Open

grapi build server fails #235

potsbo opened this issue May 7, 2020 · 0 comments

Comments

@potsbo
Copy link

potsbo commented May 7, 2020

WHY

I have a repository that contains more than 20 commands, in which sometimes I want to build only one command to save time.
And it looks like grapi offers a way to do that like grapi build <command name> but this doesn't work

$ grapi build server
  ▸  Building server
can't load package: named files must be .go files: server
failed to build [/Users/potsbo/.go/src/github.com/<repo-slug>/cmd/server/main.go /Users/potsbo/.go/src/github.com/<repo-slug>/cmd/server/run.go]: exit status 1

I did a bit of investigation to find out the cause is https://github.com/izumin5210/grapi/blob/master/pkg/grapicmd/internal/module/script/script.go#L67

Since grapi passes the args I give as an arg to the go build command, the go command receives an unexpected arg.

WHAT

I would like to fix this problem by doing below

  • not to take args in Build func
  • not to add the args into go build args

But before doing that I would like to know your intention of this code.
Maybe you wanted to let users to pass build args to go? But this doesn't work because cobra doesn't let us passing args other than specified ones, which means this cannot be done in the current architecture.

$ grapi build server -a
unknown shorthand flag: 'a' in -a

Any suggestion? @izumin5210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant