The script used to identify and update the change is added into the GitHub
workflows script directory. A workflow action can be created to trigger the
script to update the headers on the first of every new year. Possibly a task for
a consequent PR.
* 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>
- Labelled `go-backend` and `go-format-on-save` as safe local variable.
- Added local variable hooks of go mode:
- `spacemacs//go-setup-backend`
- `spacemacs//go-setup-eldoc`
- `spacemacs//go-setup-format`
See: https://github.com/syl20bnr/spacemacs/issues/14653
- Moved backend determination to `config.el`
- Replaced `pcase` form with only one-arm with `when` or `unless` form
- Replaced unnecessary backquote construct with simple quotation
This is a squash commit, it includes:
* Add go run and go test command variables
* Update go README for go-run-command and go-test-command
* Update CHANGELOG
gometalinter¹ was deprecated on 2019-02-28, in favor of the more advanced
golangci-lint.
. Drop references to gometalinter from README.org
. Update reference to available meta-linter (golangci-lint) in LAYERS.org
. Add attribution in CHANGELOG.develop
¹: https://github.com/alecthomas/gometalinter
When executing the main function which requires command line arguments, user can
set `go-run-args` to pass command line arguments to compiled binary.
The example below demonstrates how to pass command line arguments by setting
`go-run-args` as file local variable:
package main
import (
"fmt"
"os"
"strconv"
)
func main() {
//Atoi converts a string to an int
fmt.Println("Arguments:", os.Args)
a, _ := strconv.Atoi(os.Args[1])
b, _ := strconv.Atoi(os.Args[2])
result := sum(a, b)
fmt.Printf("The sum of %d and %d is %d\n", a, b, result)
}
func sum(a, b int) int {
return a + b
}
// Local Variables:
// go-run-args: "10 5"
// End:
ADD:
- layers/+lang/go/config.el Added new variable `go-use-test-args` to allow
specifying additional arguments being passed to `go test.
CHANGE:
- layers/+lang/go/packages.el Updated `go-run-tests` to automatically concat
the new variable `go-use-test-args` to args passed to `go test`.
- Use compilation-start to get highlighting of compilation or runtime errors.
- Configure output window in popwin and window-purpose (so that it can be closed
with C-g for example).
- Configurable buffer name.
Enabling a company backend for a specific mode was a tedious tasks with code
scattered at different locations, one for local variable definitions, one for
company hook function definitions and another where the backends were pushed to
the local variables (which was problematic, since we ended up pushing the same
backends over and over again with `SPC f e R`, pushes have been replaced by
add-to-list calls in the new macro).
All these steps are now put together at one place with the new macro
spacemacs|add-company-backends, check its docstring for more info on its
arguments.
This macro also allows to define arbitrary buffer local variables to tune
company for specific modes (similar to layer variables via a keyword :variables)
The code related to company backends management has been moved to the
auto-completion layer in the funcs.el file. A nice side effect of this move is
that it enforces correct encapsulation of company backends related code. We can
now easily detect if there is some configuration leakage when the
auto-completion layer is not used. But we loose macro expansion at file loading
time (not sue it is a big concern though).
The function spacemacs|enable-auto-complete was never used so it has been
deleted which led to the deletion of the now empty file core-auto-completion.el.
The example in LAYERS.org regarding auto-completion is now out of date and has
been deleted. An example to setup auto-completion is provided in the README.org
file of the auto-completion layer.
Helm seems to treat "!" specially in pattern matching, so having a ! in
the pattern string when traversing directories is problematic. This
change fixes#2737, because as far as I can tell "+" has no special
meaning in a helm pattern.
Of course, we can choose a different character, but I'm fond of "+" as
representing "more layers here".