<commit_before>;;; lang/go/config.el -*- lexical-binding: t; -*-

;;
;; Packages

(after! go-mode
  (set-env! "GOPATH" "GOROOT")
  (set-docsets! 'go-mode "Go")
  (set-repl-handler! 'go-mode #'gorepl-run)
  (set-lookup-handlers! 'go-mode
    :definition #'go-guru-definition
    :references #'go-guru-referrers
    :documentation #'godoc-at-point)

  (set-formatter! 'go-mode #'gofmt)
  (when-let* ((goimports (executable-find "goimports")))
    (setq gofmt-command goimports))
  (when (featurep! :feature syntax-checker)
    (setq gofmt-show-errors nil)) ; Leave it to flycheck

  (add-hook 'go-mode-hook #'go-eldoc-setup)

  (map! :map go-mode-map
        :localleader
        :n "r" #'go-play-buffer
        :v "r" #'go-play-region
        :n "i" #'go-goto-imports      ; Go to imports
        (:prefix "h"
          :n "." #'godoc-at-point     ; Lookup in godoc
          :n "d" #'go-guru-describe   ; Describe this
          :n "v" #'go-guru-freevars   ; List free variables
          :n "i" #'go-guru-implements ; Implements relations for package types
          :n "p" #'go-guru-peers      ; List peers for channel
          :n "P" #'go-guru-pointsto   ; What does this point to
          :n "r" #'go-guru-referrers  ; List references to object
          :n "e" #'go-guru-whicherrs  ; Which errors
          :n "w" #'go-guru-what       ; What query
          :n "c" #'go-guru-callers    ; Show callers of this function
          :n "C" #'go-guru-callees)   ; Show callees of this function
        (:prefix "r"
          :n "ia" #'go-import-add
          :n "ir" #'go-remove-unused-imports)
        (:prefix "b"
          :n "r" (λ! (compile "go run"))
          :n "b" (λ! (compile "go build"))
          :n "c" (λ! (compile "go clean")))
        (:prefix "t"
          :n "t" #'+go/test-rerun
          :n "a" #'+go/test-all
          :n "s" #'+go/test-single
          :n "n" #'+go/test-nested)))


(def-package! gorepl-mode
  :commands gorepl-run-load-current-file)


(def-package! company-go
  :when (featurep! :completion company)
  :after go-mode
  :config
  (set-company-backend! 'go-mode 'company-go)
  (setq company-go-show-annotation t))
<commit_msg>lang/go: rebind conflicting keybinds for go-play-*<commit_after>;;; lang/go/config.el -*- lexical-binding: t; -*-

;;
;; Packages

(after! go-mode
  (set-env! "GOPATH" "GOROOT")
  (set-docsets! 'go-mode "Go")
  (set-repl-handler! 'go-mode #'gorepl-run)
  (set-lookup-handlers! 'go-mode
    :definition #'go-guru-definition
    :references #'go-guru-referrers
    :documentation #'godoc-at-point)

  (set-formatter! 'go-mode #'gofmt)
  (when-let* ((goimports (executable-find "goimports")))
    (setq gofmt-command goimports))
  (when (featurep! :feature syntax-checker)
    (setq gofmt-show-errors nil)) ; Leave it to flycheck

  (add-hook 'go-mode-hook #'go-eldoc-setup)

  (map! :map go-mode-map
        :localleader
        :n "e" #'go-play-buffer
        :v "e" #'go-play-region
        :n "i" #'go-goto-imports      ; Go to imports
        (:prefix "h"
          :n "." #'godoc-at-point     ; Lookup in godoc
          :n "d" #'go-guru-describe   ; Describe this
          :n "v" #'go-guru-freevars   ; List free variables
          :n "i" #'go-guru-implements ; Implements relations for package types
          :n "p" #'go-guru-peers      ; List peers for channel
          :n "P" #'go-guru-pointsto   ; What does this point to
          :n "r" #'go-guru-referrers  ; List references to object
          :n "e" #'go-guru-whicherrs  ; Which errors
          :n "w" #'go-guru-what       ; What query
          :n "c" #'go-guru-callers    ; Show callers of this function
          :n "C" #'go-guru-callees)   ; Show callees of this function
        (:prefix "r"
          :n "ia" #'go-import-add
          :n "ir" #'go-remove-unused-imports)
        (:prefix "b"
          :n "r" (λ! (compile "go run"))
          :n "b" (λ! (compile "go build"))
          :n "c" (λ! (compile "go clean")))
        (:prefix "t"
          :n "t" #'+go/test-rerun
          :n "a" #'+go/test-all
          :n "s" #'+go/test-single
          :n "n" #'+go/test-nested)))


(def-package! gorepl-mode
  :commands gorepl-run-load-current-file)


(def-package! company-go
  :when (featurep! :completion company)
  :after go-mode
  :config
  (set-company-backend! 'go-mode 'company-go)
  (setq company-go-show-annotation t))

{'fraction_non_alphanumeric': 0.1714351110093843, 'fraction_numerical': 0.0, 'mean_word_length': 2.234641006661732, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2611886', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1668, 'n_words': 403}