spacemacs/layers/+lang/go/config.el

77 lines
2.7 KiB
EmacsLisp
Raw Normal View History

2017-02-01 14:06:00 +00:00
;;; config.el --- Go Layer config File for Spacemacs
2015-04-01 02:24:01 +00:00
;;
2021-03-22 20:11:29 +00:00
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
2015-04-01 02:24:01 +00:00
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
2015-04-01 02:24:01 +00:00
;; variables
(spacemacs|define-jump-handlers go-mode godef-jump)
(spacemacs|defc go-backend (if (configuration-layer/layer-used-p 'lsp) 'lsp 'go-mode)
"The backend to use for IDE features.
Possible values are `lsp' and `go-mode'.
If not set then `go-mode' is the default backend unless `lsp' layer is used."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'(choice (const lsp) (const go-mode)) nil t)
2018-06-11 22:05:13 +00:00
(spacemacs|defc go-use-gocheck-for-testing nil
"If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'boolean nil t)
(spacemacs|defc go-use-testify-for-testing nil
"If using testify for testing when running the tests -testify.m will be used instead of -run to specify the test that will be ran. Testify is mandatory for testing suites."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'boolean nil t)
(spacemacs|defc go-format-before-save nil
"Use gofmt before save. Set to non-nil to enable gofmt before saving. Default is nil."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'boolean nil t)
(spacemacs|defc go-tab-width 8
"Set the `tab-width' in Go mode. Default is 8."
'integer nil #'integerp)
2016-05-04 05:25:19 +00:00
(spacemacs|defc go-use-golangci-lint nil
"Use `golangci-lint' if the variable has non-nil value."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'boolean nil t)
2018-06-07 19:26:51 +00:00
(spacemacs|defc go-test-buffer-name "*go test*"
"Name of the buffer for go test output. Default is *go test*."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'string nil t)
(spacemacs|defc go-use-test-args ""
"Additional arguments to be supplied to `go test` during runtime."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'string nil t)
(spacemacs|defc go-test-verbose nil
"Control verbosity of `go test` output"
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'boolean nil t)
(spacemacs|defc go-run-args ""
"Additional arguments to by supplied to `go run` during runtime."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'string nil t)
(spacemacs|defc go-run-command "go run"
"Go run command. Default is `go run`."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'string nil t)
(spacemacs|defc go-test-command "go test"
"Go test command. Default is `go test`."
core-customization: improved SAFE variable handling (#14679) * core-customization: improved SAFE variable handling - SAFE can either be a function or t. - When it's t, use a default validation function `(lambda (val) (validate-value val TYPE t))` - When it's a function, use the supplied function. * Fixed bugs in go and groovy layer In almost any cases, it's better to supply `t` instead of a function, to `SAFE` argument of `spacemacs|defc`. For example, ```elisp (spacemacs|defc go-use-gocheck-for-testing nil "If using gocheck for testing when running the tests -check.f will be used instead of -run to specify the test that will be ran. Gocheck is mandatory for testing suites." 'boolean nil #'booleanp) ``` If its value is nil, it evaluate to `nil`, which means that `nil` is not a safe value for `go-use-gocheck-for-testing` local variable. But clearly it is. * core-customization: improved SAFE variable handling - Added a function `spacemacs-customization//get-variable-validator`. This function is designed to be used with `safe-local-variable` property of spacemacs custom variables. See details in the docstring. ```elisp (put 'FOO 'safe-local-variable (apply-partially 'spacemacs-customization//get-variable-validator 'FOO)) ``` - This is better than a lambda since `apply-partially` returns a compiled function. (Though the performace gain may be tiny.) - This is better than simply calling `validate-value`, because it returns nil when value is nil. But sometimes nil is a valid value. Co-authored-by: Lucius Hu <lebensterben@users.noreply.github.com>
2021-04-19 19:34:09 +00:00
'string nil t)