Function: projectile-test-at-point-go-command

projectile-test-at-point-go-command is a byte-compiled function defined in projectile.el.

Signature

(projectile-test-at-point-go-command TEST-NAME FILE-NAME)

Documentation

Return a go test command running TEST-NAME from FILE-NAME's package.

The command targets exactly the package containing FILE-NAME (e.g.
./pkg/foo for pkg/foo/foo_test.go); the recursive ./pkg/foo/...
form would also build every nested package and run any same-named tests they contain.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-test-at-point-go-command (test-name file-name)
  "Return a `go test' command running TEST-NAME from FILE-NAME's package.
The command targets exactly the package containing FILE-NAME (e.g.
`./pkg/foo' for `pkg/foo/foo_test.go'); the recursive `./pkg/foo/...'
form would also build every nested package and run any same-named
tests they contain."
  (let ((dir (file-name-directory file-name)))
    ;; TEST-NAME and the package directory are shell-quoted to keep a
    ;; hostile repository from injecting shell code.  The `^...$'
    ;; regexp anchors stay inside the quoting so `-run' still gets one
    ;; anchored pattern.
    (format "go test -run %s %s"
            (shell-quote-argument (concat "^" test-name "$"))
            (shell-quote-argument
             (if dir (concat "./" (directory-file-name dir)) ".")))))