Have you read GoJS Trees -- Northwoods Software ?
You probably want to use go.TreeLayout.SortingAscending or go.TreeLayout.SortingDescending.
go.TreeLayout.SortingAscending
go.TreeLayout.SortingDescending
If you search, you should find some examples of TreeLayout.comparer. For example: