Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Using go-sitemap-generator changes behavior of entire program #86
Describe the bug
It also performs other sorts of insane behavior like logging to the global logger, bypassing application level logging conventions and causing unexpected log messages that you can't easily turn off..
Please consider removing the go-sitemap-generator package as a dependency; I don't know if there's anything better out there, but this behavior is bizarre and a bit scary.
I'm trying to figure out why they did this and may file an issue upstream as well, but given that it's now baked into their API as of version 2 I don't know that it's worth trying to salvage the package. Probably best to avoid it entirely.
Thanks for the report -- good catch. Based on a quick look at their README, I'd guess this odd behavior is so you can potentially disable concurrency. Though it's not clear why you might do that.
To fix this we'll need to fork the library or find an alternative. A quick search turned this up: https://github.com/snabb/sitemap -- not sure if it's a good replacement, but anyone should feel free to investigate.
Yah, I really don't get that. You could always just do that yourself before calling any of the methods of the library; why would the library have anything to do with concurrency itself? The library doing it just forces you into a corner. Oh well. shrug
A quick glance at the godoc makes me much more confident that they actually know and are writing good Go, but I haven't looked at the code itself. It is worth noting that it also has a dependency on
This upgrades the library to v2, which lets you specify that GOMAXPROCs should always be the max number of CPUs -- and then sets it to that. One side effect of this is that images are no longer listed in sitemaps. I'm somehow at a loss on how to build and append the images array we need, with the library's latest changes. Fixes #86