           (display-buffer (current-buffer) `(,go-coverage-display-buffer-func))))))
 
 (defun go-goto-function (&optional arg)
-  "Go to the function defintion above point.
+  "Go to the function defintion (named or anonymous) surrounding point.
 
 If we are on a docstring, follow the docstring down.
 If no function is found, assume that we are at the top of a file
 and search forward instead.
 
-If we are inside an anonymous function, go to that.
-If we are inside a function that has an anonymous function inside of it and we
-are below that anonymous function, go to the root function.
-
-If one prefix argument is given, anonymous functions are skipped."
+If point is looking at the func keyword of an anonymous function,
+go to the surrounding function.
+
+If ARG is non-nil, anonymous functions are ignored."
   (interactive "P")
   (let ((p (point)))
     (cond

      (while (looking-at "^//")
        (forward-line 1))
      ;; If we are still not looking at a function, retry by calling self again.
      (when (not (looking-at "^func"))
        (go-goto-function arg)))

     ((not (looking-at "^func"))
      ;; If we are not looking at the beginning of a function line, do a regexp
      ;; search backwards
      (re-search-backward "\\<func\\>" nil t)

      ;; If nothing is found, assume that we are at the top of the file and
      ;; should search forward instead.

    ;; been supplied, redo the call so that we skip the anonymous function.
    (go-goto-function arg))))

(defun go--goto-opening-curly-brace ()
  (go--goto-return-values)
  ;; Try to place the point on the opening brace.
  (cond
   ((looking-at "(")
    (forward-list 1)
    (forward-char 1))
   ((not (looking-at "{"))
    (forward-word 1)
    (forward-char 1))))

(defun go--in-function-p (compare-point)
  "Return t if COMPARE-POINT lies inside the function immediately surrounding point."
  (save-excursion
    (when (not (looking-at "func"))
      (go-goto-function))
    (let ((start (point)))
      (go--goto-opening-curly-brace)

      (unless (looking-at "{")
        (error "expected to be looking at opening curly brace"))
      (forward-list 1)
      (and (>= compare-point start)
           (<= compare-point (point))))))

(defun go-goto-function-name (&optional arg)
  "Go to the name of the current function.
