[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 8d1594f 295/495: Automatically detect goimports
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 8d1594f 295/495: Automatically detect goimports |
Date: |
Sat, 7 Aug 2021 09:05:34 -0400 (EDT) |
branch: elpa/go-mode
commit 8d1594fa56823300d36a45c3a483de3f0d503ff2
Author: Dominik Honnef <dominik@honnef.co>
Commit: Dominik Honnef <dominik@honnef.co>
Automatically detect goimports
Instead of requiring the user to set a variable, check if the gofmt
command (minus a possible file extension) equals "goimports".
---
NEWS | 9 ++-------
go-mode.el | 11 ++++-------
2 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/NEWS b/NEWS
index 32006f7..1fe1f72 100644
--- a/NEWS
+++ b/NEWS
@@ -23,13 +23,8 @@ go-mode-1.4.0 (???)
Currently, go-packages-native (the default) and go-packages-go-list
are provided.
- * Add new customizable variable gofmt-is-goimports. If gofmt-command
- is set to a value that invokes goimports instead of gofmt, this
- variable needs to be set to t. Otherwise, goimports will not be
- able to add imports for vendored packages.
-
- Setting it to t while not using goimports will break gofmt, as
- gofmt doesn't support goimports' -srcdir flag.
+ * Automatically detect if goimports is used instead of gofmt and pass
+ the -srcdir flag, enabling support for vendoring.
* Add new customizable variable gofmt-args, a list of strings that
will be passed to gofmt as additional arguments. Primarily this
diff --git a/go-mode.el b/go-mode.el
index 758e539..660f9d7 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -195,12 +195,6 @@ from https://github.com/bradfitz/goimports."
:type 'string
:group 'go)
-(defcustom gofmt-is-goimports nil
- "Set to t if you use goimports. This is required to enable
-support for vendored packages."
- :type 'boolean
- :group 'go)
-
(defcustom gofmt-args nil
"Additional arguments to pass to gofmt."
:type '(repeat string)
@@ -1014,6 +1008,9 @@ with goflymake \(see URL
`https://github.com/dougm/goflymake'), gocode
(t
(error "invalid rcs patch or internal error in
go--apply-rcs-patch")))))))))
+(defun gofmt--is-goimports-p ()
+ (string-equal (file-name-base gofmt-command) "goimports"))
+
(defun gofmt ()
"Format the current buffer according to the gofmt tool."
(interactive)
@@ -1036,7 +1033,7 @@ with goflymake \(see URL
`https://github.com/dougm/goflymake'), gocode
(write-region nil nil tmpfile)
- (when (and gofmt-is-goimports buffer-file-name)
+ (when (and (gofmt--is-goimports-p) buffer-file-name)
(setq our-gofmt-args
(append our-gofmt-args
(list "-srcdir" (file-name-directory (file-truename
buffer-file-name))))))
- [nongnu] elpa/go-mode f9174b2 458/495: Improve go-dot-mod-mode font lock regexp, (continued)
- [nongnu] elpa/go-mode f9174b2 458/495: Improve go-dot-mod-mode font lock regexp, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 91b37c4 461/495: Disable output during indentation tests, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d712cf3 470/495: Make yes-or-no-p's PROMPT end in a space, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode bd2f6d2 467/495: Fix multiline func signature fontification., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b91a6cd 479/495: Fix composite literal key fontification, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 85a20da 482/495: Only fontify ident keys in composite literals, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 53c76cd 480/495: Speed up slow fontification after unclosed parens., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8bfc70a 484/495: Fix accidental old style backquote comma use., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d17d210 489/495: Improve go-fontify-variables logic., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 3497434 495/495: Fix fontification of chained map types., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8d1594f 295/495: Automatically detect goimports,
ELPA Syncer <=
- [nongnu] elpa/go-mode 734d523 488/495: Move some defconsts up to fix compiler warnings., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 51f507c 315/495: Complete list of commands in mode docstring, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 004575e 330/495: Don't leave godef buffer around, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 409cc64 344/495: cmd/oracle: usability improvements to "describe", "referrers", ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d9d47fa 332/495: go.tools/oracle: change -ptalog default to ""., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode bd236e5 367/495: cmd/guru: emacs: update default-directory, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2db2ff6 333/495: go.tools/oracle: change -pos flag syntax from "file pos-pos" to file:pos-pos., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 17a7d8a 370/495: cmd/guru: emacs: add function for expandiong region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dbc9124 378/495: Move go-guru.el to top level, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode b949a9b 363/495: cmd/guru: emacs: add go-guru-debug variable, ELPA Syncer, 2021/08/07