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:
When switching the Go layer to use the LSP backend with `golangci-lint`, I
noticed that none of my linter errors were being rendered with my source code.
Digging in further, I eventually learned it was due to `lsp-prefer-flymake`
being set to `nil` and not `:none`.
This change updates the Go layer, when using LSP and golangci-lint, to set
`lsp-prefer-flymake` to `:none`. If this is not set, the golangci-lint errors
will not be reported.
This is an alternative to #12043.
Fixes#11680
Signed-off-by: Tim Heckman <t@heckman.io>
Replace push with add-to-list in layer init functions and related code.
Modify spacemacs|add-toggle to check for and update an existing toggle in
spacemacs-toggles and only create a new toggle if none already existed.
Replace a conditional push onto erc-packages with use of :toggle.
When initializing which-key, set which-key-replacement-alist to its default
or customized setting before adding all the Spacemacs replacements. We
want to keep the stock replacements but avoid adding duplicates of the
Spacemacs replacements.
Replace the emacs-lisp-mode-hook lambda with a named function to avoid
adding duplicate hooks (which can add duplicate definitions of the
evil-surround pair).
This reverts commit 29c78ce841 and all other fixes
that have been made afterwards.
The motivation is that use-package is seen by many as a replacement for
`require`. Is use-package always defer the loading of packages then is breaks
this use case, this does not respect POLA so even if it was making Spacemacs
loading faster (up to 3s faster on some startup on my machine) we just cannot
use it, it would be irresponsible. Spacemacs should be easy to use, loading
performance will come with time but it is not a priority.
From <https://golang.org/doc/install> "Installing to a custom location"
> The Go binary distributions assume they will be installed in /usr/local/go
> (or c:\Go under Windows), but it is possible to install the Go tools to a
> different location. In this case you must set the GOROOT environment variable
> to point to the directory in which it was installed.
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.