emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/go-mode 27b7415 293/495: Allow passing additional argument


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 27b7415 293/495: Allow passing additional arguments to gofmt
Date: Sat, 7 Aug 2021 09:05:34 -0400 (EDT)

branch: elpa/go-mode
commit 27b74155dc2896a1809c905a7326b1d6d36014f3
Author: Dominik Honnef <dominik@honnef.co>
Commit: Dominik Honnef <dominik@honnef.co>

    Allow passing additional arguments to gofmt
    
    Closes gh-123
---
 NEWS       | 20 ++++++++++++--------
 go-mode.el | 10 +++++++++-
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 39320b3..32006f7 100644
--- a/NEWS
+++ b/NEWS
@@ -18,19 +18,23 @@ 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.
+ * Add new customizable 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.
 
- * Add new 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.
+ * 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.
 
+ * Add new customizable variable gofmt-args, a list of strings that
+   will be passed to gofmt as additional arguments. Primarily this
+   allows using the -s flag with gofmt.
+
 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 ba9cc96..e86f06d 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -201,6 +201,11 @@ support for vendored packages."
   :type 'boolean
   :group 'go)
 
+(defcustom gofmt-args nil
+  "Additional arguments to pass to gofmt."
+  :type '(repeat string)
+  :group 'go)
+
 (defcustom gofmt-show-errors 'buffer
   "Where to display gofmt error output.
 It can either be displayed in its own buffer, in the echo area, or not at all.
@@ -1035,7 +1040,10 @@ with goflymake \(see URL 
`https://github.com/dougm/goflymake'), gocode
             (setq our-gofmt-args
                   (append our-gofmt-args
                           (list "-srcdir" (file-name-directory (file-truename 
buffer-file-name))))))
-          (setq our-gofmt-args (append our-gofmt-args (list "-w" tmpfile)))
+          (setq our-gofmt-args (append our-gofmt-args
+                                       gofmt-args
+                                       (list "-w" tmpfile)))
+          (message "Calling gofmt: %s %s" gofmt-command our-gofmt-args)
           ;; We're using errbuf for the mixed stdout and stderr output. This
           ;; is not an issue because gofmt -w does not produce any stdout
           ;; output in case of success.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]