Original post

Im trying to traverse a tree, and append the values to the slice(Just format printing out the value works), but when i try to append to the slice, i dont get the values, or i get just the root of the tree.

Im not sure how to append to the slice, and make sure the data in it isint lost at the end

package main

import (
        "fmt"
)

type Node struct {
        value int
        left  *Node
        right *Node
}

type BinarySearchTree struct {
        root *Node
}


func (bst *BinarySearchTree) inOderTraversal(currNode *Node) {
        if currNode == nil {
                return
        }

        bst.inOderTraversal(currNode.left)
        
        //trying to append to a slice here, but the slice is always empty after
        //all recursive functions have been popped from the stack
        fmt.Println(currNode.value)
        
        bst.inOderTraversal(currNode.right)
}