Closed flyn-org closed 8 months ago
Would it be possible to make conditional the use of deploy in allconfig.go and alldecoders.go with something like this
We still need/want to load the config, but we should split the deploy config out into its own package, I guess.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hugo includes optional code to support website deployment. This code brings in many dependencies, and Hugo provides an option to deactivate it (-tags nodeploy).
I maintain the official Hugo package for Fedora. Packaging the deploy code's dependencies has become difficult, so I now build the Hugo package without the deploy features. The trouble is that the Fedora packaging system automatically resolves dependencies by inspecting the imports found in Go code. I can partially address this by removing the "deploy" directory before building. However, config/allconfig/allconfig.go and config/allconfig/alldecoders.go import from the deploy directory regardless of the presence of the nodeploy tag.
Would it be possible to make conditional the use of deploy in allconfig.go and alldecoders.go with something like this
?
That would go a long way to make packaging less fragile and more straight forward.
Here are my current steps, which might help illustrate what I am trying to describe:
rm -rf deploy
.sed -i '/"github.com\/gohugoio\/hugo\/deploy"/d' config/allconfig/allconfig.go # Remove import.
sed -i 's/Deployment deploy.DeployConfig/Deployment bool/g' config/allconfig/allconfig.go # Replace use with bool.
sed -i '/"github.com\/gohugoio\/hugo\/deploy"/d' config/allconfig/alldecoders.go # Remove import.
sed -i 's/p.c.Deployment, err =/\/\/ p.c.Deployment, err =/g' config/allconfig/alldecoders.go # Comment out use.
-tags nodeploy
.-tags nodeploy
.Steps 1, 3, and 4 are fine. Step 2 is what I would like to avoid.