Function: projectile--go-work-patterns

projectile--go-work-patterns is a byte-compiled function defined in projectile.el.

Signature

(projectile--go-work-patterns FILE)

Documentation

Return the module directories a Go workspace file FILE puts to use.

Both the parenthesised use (...) block and single-line use ./dir are understood.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--go-work-patterns (file)
  "Return the module directories a Go workspace file FILE puts to use.
Both the parenthesised `use (...)' block and single-line `use ./dir' are
understood."
  (let ((text (projectile--file-contents file))
        (out nil))
    (when (string-match "use[[:space:]]*(\\([^)]*\\))" text)
      (dolist (line (split-string (match-string 1 text) "\n" t))
        (let ((entry (string-trim (replace-regexp-in-string "//.*" "" line))))
          (unless (string-empty-p entry) (push entry out)))))
    (let ((start 0))
      (while (string-match "^[[:space:]]*use[[:space:]]+\\([^(\n]+\\)$" text start)
        (push (string-trim (match-string 1 text)) out)
        (setq start (match-end 0))))
    (nreverse out)))