I'm trying to count the number of good nodes i.e. the number of nodes which the path to reach the node doesn't contain a node with a greater value.

I use a helper recursive function which passes the current highest observed value as a parameter. However, assigning to this parameter doesn't seem to work as shown in the code below.

```golang
package main

import "fmt"

type TreeNode struct {
    Val   int
    Left  *TreeNode
    Right *TreeNode
}

func main() {
    root := &TreeNode{2, nil,
        &TreeNode{4, &TreeNode{10, nil, nil},
            &TreeNode{8, &TreeNode{4, nil, nil}, nil}}}
    fmt.Println(goodNodes(root)) // prints 5 instead of 4
}

func goodNodes(root *TreeNode) int {
    numGoodNodes := 0
    var helper func(*TreeNode, int)
    helper = func(tn *TreeNode, highest int) {
        if tn == nil {
            return
        }
        fmt.Println(tn, highest)
        if tn.Val >= highest {
            numGoodNodes += 1
            highest = root.Val //? this assignment fails, not sure why
        }
        fmt.Println(tn, highest)
        helper(tn.Left, highest)
        helper(tn.Right, highest)
    }
    helper(root, -1e4)
    return numGoodNodes
}

```

I'm fairly new to golang and would like to understand why it doesn't work as I expect it to.