cli icon indicating copy to clipboard operation
cli copied to clipboard

Remove `go generate` from v2 build process

Open abitrolly opened this issue 1 year ago • 5 comments

My urfave/cli version is

v2

Checklist

  • [x] Are you running the latest v2 release? The list of releases is here.
  • [x] Did you check the manual for your release? The v2 manual is here
  • [ ] Did you perform a search about this problem? Here's the GitHub guide about searching.

Dependency Management

  • My project is using go modules.
  • My project is using vendoring.
  • My project is automatically downloading the latest version.
  • I am unsure of what my dependency management setup is.

Describe the bug

The generation step when calling make from https://cli.urfave.org/CONTRIBUTING/#development-workflow takes way too much detours.

Observed behavior

graph LR
make --> build.go --> gogen[go generate] --> cli.go --> urfave-cli-genflags/make --> urfave-cli-genflags --> goimports

Expected behavior

At least this.

graph LR
make --> build.go --> urfave-cli-genflags/make --> urfave-cli-genflags --> goimports

Additional context

Did I miss anything?

Want to fix this yourself?

Yup. If there is no some hidden magic behind.

abitrolly avatar Jul 23 '23 06:07 abitrolly

@abitrolly Do you really want to optimize this since we are moving forward with v3 ? Does the analysis apply to v3 ?

dearchap avatar Nov 24 '23 20:11 dearchap

@dearchap yes. That will make v2 maintenance easier. In case somebody needs to build it with modifications for debug.

abitrolly avatar Nov 25 '23 07:11 abitrolly

v3 doesn't seem the be affected.

abitrolly avatar Nov 25 '23 07:11 abitrolly

Instead the build process should depend on go generate and not on make because that's the idiomatic way. See discussion in #1802 for opinions.

dolmen avatar May 31 '24 15:05 dolmen

@dolmen "if all you have is a hammer, everything looks like a nail".

I need a reference that calling make from Go code is the idiomatic Go. As shown by https://github.com/urfave/cli/pull/1802#issuecomment-1953505678 it is make calling Go, then Go calling make to call an app. Much more maintainable it to have make call the app.

abitrolly avatar Jun 01 '24 04:06 abitrolly