lassik / emacs-format-all-the-code

Auto-format source code in many languages with one command
https://melpa.org/#/format-all
MIT License
604 stars 105 forks source link

wrong-number-of-arguments with go #249

Closed larrasket closed 9 months ago

larrasket commented 9 months ago

The package works normally except for Go files. I've gofmt in my path and running M-x gofmt works normally as well. Here is the error I'm getting of before-save-hook or running format-all-buffer:

Debugger entered--Lisp error: (wrong-number-of-arguments (lambda (executable mode-result) (let (args) (dolist (arg '(("%s" ...))) (cond ((stringp arg) (push arg args)) ((listp arg) (catch 'skip (let ... ... ...))))) (doom-log "formatter (arglist) %s" args) (if nil (apply #'format-all--buffer-hard 'nil nil nil (reverse args)) (apply #'format-all--buffer-easy (reverse args))))) 3)
  (lambda (executable mode-result) (let (args) (dolist (arg '(("%s" ...))) (cond ((stringp arg) (push arg args)) ((listp arg) (catch 'skip (let ... ... ...))))) (doom-log "formatter (arglist) %s" args) (if nil (apply #'format-all--buffer-hard 'nil nil nil (reverse args)) (apply #'format-all--buffer-easy (reverse args)))))("/usr/bin/gofmt" "Go" nil)
  #f(compiled-function () #<bytecode 0x44ea6fcdcddda6c>)()
  format-all--save-line-number(#f(compiled-function () #<bytecode 0x44ea6fcdcddda6c>))
  #f(compiled-function () #<bytecode -0x1122acf146cb233b>)()
  format-all--save-mark-ring(#f(compiled-function () #<bytecode -0x1122acf146cb233b>))
  format-all--run-chain("Go" (gofmt) nil)
  format-all--buffer-from-hook()
  run-hooks(before-save-hook)
  basic-save-buffer(t)
  save-buffer(1)
  funcall-interactively(save-buffer 1)
  command-execute(save-buffer)
larrasket commented 9 months ago

Looks like it was a doom-related issue. I commented out the formatter module from init.el, it works normally now.

(note: latest versions of doom does not use the format-all pacakge)

-- Regards, Salih