 
 (use-package go-add-tags
   :ensure go-add-tags)
+
+(use-package flycheck
+  :config
+  (setq flycheck-highlighting-mode 'lines))
+
+(use-package flycheck-golangci-lint)
+
+(add-hook 'go-mode-hook 'flycheck-mode)
 
 ;; (use-package flycheck
 ;;   :config

(put 'magit-clean 'disabled nil)

(use-package dumb-jump
  :after ivy
  :bind (("M-g o" . dumb-jump-go-other-window)
	 ("M-g j" . dumb-jump-go)
	 ("M-g i" . dumb-jump-go-prompt)
	 ("M-g x" . dumb-jump-go-prefer-external)
	 ("M-g z" . dumb-jump-go-prefer-external-other-window))
  :config (setq dumb-jump-selector 'ivy)
  ;; (setq dumb-jump-selector 'helm)
  :ensure)

;;Load auto-complete


(setq aim/prefer-ac-complete t)

(use-package smartparens)

;; (if aim/prefer-ac-complete
;;     (aim/setup-ac-complete)
;;   (aim/setup-company-complete))

(use-package yasnippet)

(use-package yasnippet
  :init
  (yas-global-mode 1))

(use-package yasnippet-snippets)
;;(use-package yasnippet-classic-snippets)

(use-package projectile
  :ensure t
  :bind (:map projectile-mode-map
              ("C-c p" . 'projectile-command-map))

  :config 
  (projectile-mode +1))

(use-package lsp-mode
  :ensure t
  :commands lsp
  :custom
  (lsp-auto-guess-root nil)
  (lsp-prefer-flymake nil) ; Use flycheck instead of flymake
  :config
  (setq lsp-auto-guess-root t)
  (setq lsp-inhibit-message t)
  ;;(setq lsp-message-project-root-warning t)
  :bind (:map lsp-mode-map ("C-c C-f" . lsp-format-buffer))
  :hook ((go-mode c-mode c++-mode) . lsp))

(use-package lsp-ui
  :after lsp-mode
  :diminish
  :commands lsp-ui-mode
  ;; :custom-face
  ;; (lsp-ui-doc-background ((t (:background nil))))
  ;; (lsp-ui-doc-header ((t (:inherit (font-lock-string-face italic)))))
  :bind (:map lsp-ui-mode-map
              ([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
              ([remap xref-find-references] . lsp-ui-peek-find-references)
              ("C-c u" . lsp-ui-imenu))
  :custom
  (lsp-ui-doc-enable t)
  (lsp-ui-doc-header t)
  (lsp-ui-doc-include-signature t)
  (lsp-ui-doc-position 'top)
  (lsp-ui-doc-border (face-foreground 'default))
  (lsp-ui-sideline-enable nil)
  (lsp-ui-sideline-ignore-duplicate t)
  (lsp-ui-sideline-show-code-actions nil)
  :config
  ;; Use lsp-ui-doc-webkit only in GUI
  (setq lsp-ui-doc-use-webkit t)
  ;; WORKAROUND Hide mode-line of the lsp-ui-imenu buffer
  ;; https://github.com/emacs-lsp/lsp-ui/issues/243
  (defadvice lsp-ui-imenu (after hide-lsp-ui-imenu-mode-line activate)
    (setq mode-line-format nil)))

(use-package company-lsp
  :commands company-lsp
  :config
  (push 'company-lsp company-backends))

;; from https://lupan.pl/dotemacs/
;; Go/speedbar integration

(eval-after-load 'speedbar
  '(speedbar-add-supported-extension ".go"))

;; (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
;; (define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)

;;(setq projectile-project-search-path '("~/go-projects/" "~/frobware/"))

