I currently have an EmployeeNode struct that represents a company Org Tree with the root EmployeeNode representing the CEO of the company. It looks like below:
type EmployeeNode struct {
UserName string
Children []*EmployeeNode
}
root := {
UserName: "Bob Wang",
Children: [
{
UserName: "Jim Halpert",
Children: [
{
UserName: "Brett Wang",
Children: []
},
{
UserName: "Ryan Wang",
Children: []
}
]
}
{
UserName: "Michael Wang",
Children: [
{
UserName: "Annie Wang",
Children: []
},
{
UserName: "Jay Wang",
Children: []
},
]
}
]
}
]
Given this sample root data, how can I dynamically generate an HTML table in Golang using HTML templates, that shows the Org Tree like below?:

Each EmployeeNode can have many children, or no children and I want to dynamically display this nested list structure as a table in HTML. I already know how to pass this EmployeeNode struct to a HTML template in Golang, but just not sure how to actually create the tables dynamically using this EmployeeNode struct. Thanks!
