0

I 've below emacs init file config setup

I'm getting below error in the emacs startup. I don't know what might be the root cause of the issue

the following functions might not be defined at runtime: lsp-format-buffer, lsp-organize-imports the function ‘dap-go-setup’ is not known to be defined.

The emacs file is -

~/.emacs.d/init.el file is

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

(package-initialize)

(add-to-list 'package-archives
            '("melpa-stable" . "https://stable.melpa.org/packages/") t)

(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))

(require 'use-package)


(load "~/.emacs.d/golang.el")

My ~/.emacs.d/golang.el file is -

(use-package lsp-mode
:ensure t
:commands (lsp lsp-deferred)
:hook (go-mode . lsp-deferred))

;; Set up before-save hooks to format buffer and add/delete imports.
;; Make sure you don't have other gofmt/goimports hooks enabled.
(defun lsp-go-install-save-hooks ()
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t))
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)

;; Optional - provides fancier overlays.
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode
:init)

;; Company mode is a standard completion package that works well with lsp-mode.
(use-package company
:ensure t
:config
;; Optionally enable completion-as-you-type behavior.
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1))

(use-package company-lsp
:ensure t
:commands company-lsp)

;; Optional - provides snippet support.
(use-package yasnippet
:ensure t
:commands yas-minor-mode
:hook (go-mode . yas-minor-mode))

(use-package dap-mode
;;:custom
;;(dap-go-debug-program `("node" "~/extension/out/src/debugAdapter/goDebug.js"))
:config
(dap-mode 1)
(setq dap-print-io t)
;;(setq fit-window-to-buffer-horizontally t)
;;(setq window-resize-pixelwise t)
(require 'dap-hydra)
(require 'dap-go)       ; download and expand vscode-go-extenstion to the =~/.extensions/go=
(dap-go-setup)
(use-package dap-ui
    :ensure nil
    :config
    (dap-ui-mode 1)
    )
)

(use-package flycheck-golangci-lint
:ensure t)

(setq lsp-ui-doc-enable nil
    lsp-ui-peek-enable t
    lsp-ui-sideline-enable t
    lsp-ui-imenu-enable t
    lsp-ui-flycheck-enable t)


(setq lsp-gopls-staticcheck t)
(setq lsp-eldoc-render-all t)
(setq lsp-gopls-complete-unimported t)

My operating system is -

$ lsb_release -a
LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:    20.2
Codename:   Nibia

What is the root cause of this issue?

1
  • It's not an error message. It's a warning. Where/when are you seeing it? Do you see it as a byte-compiler warning? Are you byte-compiling your init file (don't bother)? – Drew Dec 21 '20 at 16:06
0

Add :commands entries for the relevant functions.

(use-package lsp-mode
:ensure t
:commands (lsp lsp-deferred lsp-format-buffer lsp-organize-imports)
:hook (go-mode . lsp-deferred))

(use-package dap-mode
:commands dap-go-setup ; I think :functions will also work
:config
(dap-mode 1)
(setq dap-print-io t)
(require 'dap-hydra)
(require 'dap-go) ; download and expand vscode-go-extenstion to the =~/.extensions/go=
(dap-go-setup)
(use-package dap-ui
    :ensure nil
    :config
    (dap-ui-mode 1)
    ))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.