 ;;(company-tng-configure-default)
 
 ;; (use-package go-mode
-;;   :ensure go-mode
-;;   :mode "\\.go\\'"
-;;   :config
-;;   ;; (add-hook 'go-mode 'gofmt-before-save)
-;;   ;; (remove-hook 'go-mode 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
-;;   ;; (setq gofmt-command "goimports")
-;;   (bind-key "C-M-x" 'aim/run-go-buffer go-mode-map)
-;;   (bind-key "C-M-i" 'helm-company go-mode-map)
-;;   ;;(bind-key "M-." 'godef-jump go-mode-map)
-;;   )
-
-;; (use-package go-mode
-;;   :mode "\\.go\\'"
-;;   :custom (gofmt-command "goimports")
-;;   :bind (:map go-mode-map
-;;	      ("C-c C-n" . go-run)
-;;	      ("C-c ."   . go-test-current-test)
-;;	      ("C-c f"   . go-test-current-file)
-;;	      ("C-c a"   . go-test-current-project))
-;;   :config
-;;   (add-hook 'before-save-hook #'gofmt-before-save)
+;;   :mode
+;;   "\\.go\\'"
+;;   :config
 ;;   (setq gofmt-command "goimports")
-;;   (use-package gotest)
-;;   (use-package go-tag
-;;     :config (setq go-tag-args (list "-transform" "camelcase"))))
+;;   (remove-hook 'go-mode 'flymake-diagnostic-functions 'flymake-proc-legacy-flymake)
+;;   :bind
+;;   (:map go-mode-map
+;; 	("C-M-x" . aim/run-go-buffer)
+;; 	("M-." . godef-jump)))
 
 (use-package go-mode
-  :init
-  (setq go-fontify-function-calls nil)
-  :config
+  :mode "\\.go\\'"
+  :custom (gofmt-command "goimports")
+  :bind (:map go-mode-map
+	      ("C-c C-n" . go-run)
+	      ("C-c ."   . go-test-current-test)
+	      ("C-c f"   . go-test-current-file)
+	      ("C-c a"   . go-test-current-project))
+  :config
+  (add-hook 'before-save-hook #'gofmt-before-save)
   (setq gofmt-command "goimports")
-  :hook (
-         ;; (go-mode . lsp)
-	 (go-mode . smartparens-mode)
-	 (go-mode . gofmt-before-save)))
+  (use-package gotest)
+  (use-package go-tag
+    :config (setq go-tag-args (list "-transform" "camelcase"))))
+
+(use-package flycheck)
 
 (defun aim/setup-ac-complete nil
   (interactive)

	 ("C-c e R" . lsp-rename)
	 ("C-c e i" . lsp-find-implementation)
	 ("C-c e t" . lsp-find-type-definition))
  :hook ((lisp-mode . lsp-deferred)
	 (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))
;;(remove-hook 'go-mode-hook #'lsp-go-install-save-hooks)

;;Optional - provides fancier overlays.
;; (use-package lsp-ui)


(use-package lsp-mode
  :commands (lsp lsp-deferred)
  :hook ((before-save . lsp-format-buffer)
         (before-save . lsp-organize-imports))
  :bind (("C-c d" . lsp-describe-thing-at-point)
	 ("C-c e n" . flymake-goto-next-error)
	 ("C-c e p" . flymake-goto-prev-error)
