Small coding questions (code review)

I’ll add some small questions in this thread. I’m debuting in Go and I’m learning from some projects as well as hugo.


I believe this if serves no purpose and could be removed:
if len(newcontent) == len(ct.Content()) { head := "<HEAD>" replace := []byte(fmt.Sprintf("%s\n\t%s", head, hugoGeneratorTag)) newcontent = bytes.Replace(ct.Content(), []byte(head), replace, 1) }

No, it serves a perfectly fine purpose, otherwise, it would have been long time removed.

We welcome new contributors and this is in general a very helpful crowd. But you ask some very basic questions that I feel is better suited for a more general developer forum, or maybe you should read some “Go programmers guides” or similar.

Thanks. I explored hugogeneratorinject_test.go, ran it and I see what I missed.

There are still some concepts I don’t fully understand.

I’ll read more.