Listing which file is deprecated?

The current way to handle this is to grep the key it’s complaining about (like .Url and .Hugo in the gitlab pages example site),

but my question is this:

is there an option that’d just tell me this /from/ the debug message? If they’re already saying “you have problems with this key”, why not say “I noticed that while looking at this file”?

:frowning: I swear I’m not dumb but that took me 45 minutes without coffee this morning.

for example, per, the .Url in partials/nav.html /shouldn’t/ be changed because it’s the /site’s/ URL… so Grep won’t always work.

I’d think such a feature would be useful in not only this use case, but I don’t know if that’s the direction the hugo developers were going.

It’s not possible to implement

Or, everything is possible, but if I had thought of a (simple) way, I would implement it. But I’m glad to be proven wrong.

1 Like

I’m not as strong a Go developer as you, and you’ve made previous comments about the maintainability of tests in regards to pull #4796 github . com/gohugoio/hugo/pull/4796, so I recognize that you want things to be easy to maintain, but they do need to be easy to use. That’s been a point in the documentation to mention that it’s magic, and while that’s true, it’s also a bit unwieldy to find what went wrong.

It looks like we use a depreciation function in general.go github . com/gohugoio/hugo/blob/master/helpers/general.go#L327 , and lots of autogenerated wrapper functions to warn about different key types not in use in page_wrappers.autogen.go github . com/gohugoio/hugo/blob/master/resources/page/page_wrappers.autogen.go, and a generator (for those?) in generate_page_wrappers.go github . com/gohugoio/hugo/blob/master/resources/page/page_generate/generate_page_wrappers.go#L136.

Why does all this code feel like it’s a django ORM that can simply be /generated/ to have that warning built in?

I can’t put my finger on where that’s happening, and if I could, I’d have suggested it.

maybe the function is too far along to retrace who owns it, or you weren’t after object inheritance, or the result object can’t contain that warning when it spits out the file at the end…

either from the helper that warns of such depreciation (by being passed that value, changing the signature if it doesn’t have it, becoming annoying for your tests)

or from the return of the function after it’s generated the file, maybe they’re batched, so even that can’t happen.

or, more likely, it’s something to do with the autogenerated code being really annoying to deal with ;-;

I recognize you have a very busy life and it’s super cool how you’ve built it, features like these would be very, very helpful.

and I can’t find how the heck one’d fix it, because the codebase just feels unintuitive (or I’d have patched it in my own instance, had hugo with debug lines, and gone home --I can’t write a thing as cool as hugo from scratch).

:confused: link limits for new discord users…

If you have a suggested and working solution, I suggest you create a Pull Request and I will look at it. I can just throw in that the main problem here is that we don’t have any way to get the calling context (template) when these deprecated methods are invoked.