[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 0f9b5c5 291/495: Add go-packages-function and go-p
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 0f9b5c5 291/495: Add go-packages-function and go-packages-go-list |
Date: |
Sat, 7 Aug 2021 09:05:34 -0400 (EDT) |
branch: elpa/go-mode
commit 0f9b5c5f92ab5ac27ad22663ddd2e423c632795b
Author: Dominik Honnef <dominik@honnef.co>
Commit: Dominik Honnef <dominik@honnef.co>
Add go-packages-function and go-packages-go-list
Allow choosing between different ways of finding installed packages.
go-packages will call go-packages-function.
The old implementation of go-packages, which looks for .a files, now
lives in go-packages-native and is the default value for
go-packages-function.
A new implementation based on calling 'go list all' was added as
go-packages-go-list. This function produces better results, but can be
significantly slower.
Closes gh-120
---
NEWS | 5 +++++
go-mode.el | 25 +++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/NEWS b/NEWS
index dc9a362..4983edd 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,11 @@ go-mode-1.4.0 (???)
- go-goto-return-values
- go-goto-method-receiver
+ * Add new variable go-packages-function, which allows choosing
+ between different ways of finding installed packages. Currently,
+ go-packages-native (the default) and go-packages-go-list are
+ provided.
+
go-mode-1.3.1 (2015-07-03)
* The 1.3.0 release forgot to update the version in the package
diff --git a/go-mode.el b/go-mode.el
index da87c00..3b2747e 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -220,6 +220,20 @@ a `before-save-hook'."
:type '(repeat (list regexp (choice (repeat string) function)))
:group 'go)
+(defcustom go-packages-function 'go-packages-native
+ "Function called by `go-packages' to determine the list of
+available packages. This is used in e.g. tab completion in
+`go-import-add'.
+
+This package provides two functions: `go-packages-native' uses
+elisp to find all .a files in all /pkg/ directories.
+`go-packages-go-list' uses 'go list all' to determine all Go
+packages. `go-packages-go-list' generally produces more accurate
+results, but can be slower than `go-packages-native'."
+ :type 'function
+ :package-version '(go-mode . 1.4.0)
+ :group 'go)
+
(defun go--kill-new-message (url)
"Make URL the latest kill and print a message."
(kill-new url)
@@ -1305,6 +1319,11 @@ If IGNORE-CASE is non-nil, the comparison is
case-insensitive."
(defun go-packages ()
+ (funcall go-packages-function))
+
+(defun go-packages-native ()
+ "Return a list of all installed Go packages. It looks for
+archive files in /pkg/"
(sort
(delete-dups
(mapcan
@@ -1322,6 +1341,12 @@ If IGNORE-CASE is non-nil, the comparison is
case-insensitive."
(go-root-and-paths)))
#'string<))
+(defun go-packages-go-list ()
+ "Return a list of all Go packages, using `go list'"
+ (with-temp-buffer
+ (call-process go-command nil (current-buffer) nil "list" "-e" "all")
+ (split-string (buffer-string) "\n" t)))
+
(defun go-unused-imports-lines ()
;; FIXME Technically, -o /dev/null fails in quite some cases (on
;; Windows, when compiling from within GOPATH). Practically,
- [nongnu] elpa/go-mode 10f7d10 260/495: go-goto-return-value: don't move past pointer, (continued)
- [nongnu] elpa/go-mode 10f7d10 260/495: go-goto-return-value: don't move past pointer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b78582a 262/495: Rename go-goto-type-signature to go-goto-method-receiver, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a16e2e0 266/495: Update docstring and comments for go--in-function-p, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 94ffc7a 270/495: go-goto-docstring: insert function name even if empty comment, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 093a492 274/495: Rename go--in-function-p to go--below-anonymous-function, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2f302d2 279/495: Update go--goto-opening-curly-brace to handle more cases, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 29f3380 280/495: Remove trailing whitespace in go-mode.el, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dd46d4f 281/495: Modify go--goto-opening-curly-brace to use end-of-defun, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6fc1f35 282/495: Move go-goto keymap to the rest of the keymap, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 400d2ae 289/495: Add a changelog, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0f9b5c5 291/495: Add go-packages-function and go-packages-go-list,
ELPA Syncer <=
- [nongnu] elpa/go-mode 8c884f3 292/495: Support goimports' new -srcdir flag, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c65dd39 297/495: Complain about outdated goimports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0b5b29d 316/495: Reformat code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a6717a1 318/495: Fix filename replacement in gofmt error buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 50bceae 326/495: Use HTTPS with go-play-region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 49521d5 310/495: Add go-reset-gopath, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b767500 325/495: Set compilation-error-screen-columns to nil, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 15ea9a4 320/495: No longer provide a default in M-x godoc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 22cbf11 321/495: Support unsaved buffers with gogetdoc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 0b25cb5 327/495: Generate HTTPS URL for playground entry, ELPA Syncer, 2021/08/07