如何根据结构的lastName变量对结构列表进行排序

Before you ask, yes, I must use a list. I can not use a slice or anything else. So, I have a list full of structures, but the list needs to be sorted based on the lastname variable of the struct. I've tinkered with things but ultimately have nothing to show for it. I'm not asking for an answer, but just some guidance in the right direction. Any help would be appreciated!

So since you have to use a golang list, I'd recommend looking into

Solutions involving slices likely won't help you since you'll have to do linked list comparisons (and Go's implementation of lists is a little complicated!) Another hint: you'll likely have to do for loop iterations, so expect some O(n^2) complexity.

Hope this helps! :)