Hello @spf13 and thank you for your many great contributions. I contributed to Hugo some time ago and use it for several sites!
The typical go pattern is to use the cmd directory like an index of all buildable binaries in a project. Cobra directly conflicts with this by recommending that the cmd directory is used to hold small packages which each contain cobra command packages.
Please consider recommending a more compatible file structure, such as this one that nests cobra commands with their relevant binaries:
project/
Dockerfile
kubernetes.yaml
README.md
cmd/
binaryNameA/
main.go
cobraCommandA/
cobraCommandA.go
cobraCommandB/
cobraCommandB.go
binaryNameB/
main.go
otherStuff.go
pkg/
packageName/
packageName.go
Or perhaps this layout, which organizes the cobra command packages as packages:
project/
Dockerfile
kubernetes.yaml
README.md
cmd/
binaryNameA/
main.go
binaryNameB/
main.go
otherStuff.go
pkg/
packageName/
packageName.go
cobraCommandA/
cobraCommandA.go
cobraCommandB/
cobraCommandB.go
The goal here is to enable the typical cmd/ directory behavior - rather than trying to make cobra users decide which layout to use.
Thanks again!
Hello @spf13 and thank you for your many great contributions. I contributed to Hugo some time ago and use it for several sites!
The typical go pattern is to use the
cmddirectory like an index of all buildable binaries in a project. Cobra directly conflicts with this by recommending that thecmddirectory is used to hold small packages which each contain cobra command packages.Please consider recommending a more compatible file structure, such as this one that nests cobra commands with their relevant binaries:
Or perhaps this layout, which organizes the cobra command packages as packages:
The goal here is to enable the typical
cmd/directory behavior - rather than trying to make cobra users decide which layout to use.Thanks again!