Function: go-test--get-current-buffer
go-test--get-current-buffer is a natively compiled function defined in
gotest.el.
Signature
(go-test--get-current-buffer)
Documentation
Return the test buffer for the current buffer-file-name(var)/buffer-file-name(fun).
If buffer-file-name(var)/buffer-file-name(fun) ends with _test.go, current-buffer is returned.
Otherwise, ff-get-other-file is used to find the test buffer.
For example, if the current buffer is foo.go, the buffer for
foo_test.go is returned.
Source Code
;; Defined in /nix/store/y8iliarhkh17m4iiwcy1hbi78r7b5489-emacs-packages-deps/share/emacs/site-lisp/elpa/gotest-20230221.945/gotest.el
(defun go-test--get-current-buffer ()
"Return the test buffer for the current `buffer-file-name'.
If `buffer-file-name' ends with `_test.go', `current-buffer' is returned.
Otherwise, `ff-get-other-file' is used to find the test buffer.
For example, if the current buffer is `foo.go', the buffer for
`foo_test.go' is returned."
(if (string-match "_test\.go$" buffer-file-name)
(current-buffer)
(let ((ff-always-try-to-create nil)
(filename (ff-get-other-file)))
(when filename
(find-file-noselect filename)))))