diff --git a/.golangci.yaml b/.golangci.yaml index 79af564..791984f 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,5 +1,6 @@ -run: - skip-dirs: +--- +issues: + exclude-dirs: - internal/tmp output: @@ -19,9 +20,8 @@ linters: - govet - makezero - noctx - - rowserrcheck # - scopelint - - sqlclosecheck + # - sqlclosecheck - staticcheck - typecheck # complexity diff --git a/cmd/backup.go b/cmd/backup.go index c67359d..afbbe52 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -41,7 +41,7 @@ This command loads the current persona from DEVID_ACTIVE_PERSONA environment var value takes precedence over the --persona flag. `, Args: cobra.NoArgs, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { p, err := utils.LoadPersona(cmd) if err != nil { ui.Fatal(fmt.Errorf("cannot instantiate persona: %w", err), noPersonaLoadedExitCode) diff --git a/cmd/delete.go b/cmd/delete.go index 5810eea..365ad1b 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -43,7 +43,7 @@ further details. This command loads the current persona from DEVID_ACTIVE_PERSONA environment variable, and this value takes precedence over the --persona flag. `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { p, err := utils.LoadPersona(cmd) if err != nil { ui.Fatal(fmt.Errorf("cannot instantiate persona: %w", err), noPersonaLoadedExitCode) diff --git a/cmd/edit.go b/cmd/edit.go index d616cc8..5b0a084 100644 --- a/cmd/edit.go +++ b/cmd/edit.go @@ -40,7 +40,7 @@ Allowed EDITOR values: %s This command loads the current persona from DEVID_ACTIVE_PERSONA environment variable, and this value takes precedence over the --persona flag. `, utils.AllowedEditors), - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { p, err := cmdutils.LoadPersona(cmd) if err != nil { ui.Fatal(fmt.Errorf("cannot instantiate persona: %w", err), genericExitCode) diff --git a/cmd/list.go b/cmd/list.go index 312d8f4..73e8c10 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -32,7 +32,7 @@ func List() *cobra.Command { Use: "list", Short: "list personas", Long: `List all available personas.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { files, err := os.ReadDir(viper.GetString("personas_location")) if err != nil { ui.Fatal(fmt.Errorf("cannot read folder content: %w", err), noPersonaLoadedExitCode) diff --git a/cmd/new.go b/cmd/new.go index be718bc..6b32fb0 100644 --- a/cmd/new.go +++ b/cmd/new.go @@ -41,7 +41,7 @@ trigger an unknown command execution trough this command. Allowed EDITOR values: %s `, utils.AllowedEditors), Args: cobra.MinimumNArgs(1), - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, args []string) { runCommand(args) }, } diff --git a/cmd/root.go b/cmd/root.go index 0efcad6..7b76ec0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -50,7 +50,7 @@ Environment variables: - DEVID_PERSONAS_LOCATION (default $XDG_DATA_HOME/devid/personas): specify where devid will look for persona's folders. `, - PersistentPreRun: func(cmd *cobra.Command, args []string) { + PersistentPreRun: func(_ *cobra.Command, _ []string) { if !verbose { log.SetOutput(io.Discard) } diff --git a/cmd/shell.go b/cmd/shell.go index 14d34d2..0b66237 100644 --- a/cmd/shell.go +++ b/cmd/shell.go @@ -21,7 +21,7 @@ func Shell() *cobra.Command { This command loads the current persona from DEVID_ACTIVE_PERSONA environment variable, and this value takes precedence over the --persona flag.`, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { p, err := utils.LoadPersona(cmd) if err != nil { ui.Fatal(fmt.Errorf("cannot instantiate persona: %w", err), noPersonaLoadedExitCode) diff --git a/cmd/whoami.go b/cmd/whoami.go index 8448674..4de6d6f 100644 --- a/cmd/whoami.go +++ b/cmd/whoami.go @@ -39,7 +39,7 @@ If no persona is loaded print nothing and exit with code 128. This command loads the current persona from DEVID_ACTIVE_PERSONA environment variable, and this value takes precedence over the --persona flag. `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { p, err := utils.LoadPersona(cmd) if err != nil { ui.Fatal(fmt.Errorf("cannot instantiate persona: %w", err), noPersonaLoadedExitCode) diff --git a/devenv.lock b/devenv.lock index f1294cc..532c881 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,11 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1686054274, - "narHash": "sha256-93aebyN7EMmeFFXisFIvp28UEbrozu79vd3pKPjvNR0=", + "lastModified": 1717245169, + "narHash": "sha256-+mW3rTBjGU8p1THJN0lX/Dd/8FbnF+3dB+mJuSaxewE=", "owner": "cachix", "repo": "devenv", - "rev": "c51a56bac8853c019241fe8d821c0a0d82422835", + "rev": "c3f9f053c077c6f88a3de5276d9178c62baa3fc3", "type": "github" }, "original": { @@ -20,11 +20,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -33,24 +33,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -59,11 +41,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -74,11 +56,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1685938391, - "narHash": "sha256-96Jw6TbWDLSopt5jqCW8w1Fc1cjQyZlhfBnJ3OZGpME=", + "lastModified": 1717399147, + "narHash": "sha256-eCWaE/q1VItpFAxxLVt171MdtDcjEnwi6QB/yuF73JU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "31cd1b4afbaf0b1e81272ee9c31d1ab606503aed", + "rev": "4a4ecb0ab415c9fccfb005567a215e6a9564cdf5", "type": "github" }, "original": { @@ -90,16 +72,16 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } @@ -107,7 +89,6 @@ "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" @@ -115,11 +96,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1686050334, - "narHash": "sha256-R0mczWjDzBpIvM3XXhO908X5e2CQqjyh/gFbwZk/7/Q=", + "lastModified": 1716213921, + "narHash": "sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "6881eb2ae5d8a3516e34714e7a90d9d95914c4dc", + "rev": "0e8fcc54b842ad8428c9e705cb5994eaf05c26a0", "type": "github" }, "original": { @@ -134,21 +115,6 @@ "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/devenv.nix b/devenv.nix index 19a37dd..c1cdd9d 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,10 +1,6 @@ { pkgs, ... }: { - # https://devenv.sh/basics/ - env.GREET = "devenv"; - - # https://devenv.sh/packages/ packages = [ pkgs.git pkgs.go @@ -14,23 +10,12 @@ pkgs.silver-searcher ]; - # https://devenv.sh/scripts/ - scripts.hello.exec = "echo hello from $GREET"; - enterShell = '' git --version go version task --version + golangci-lint --version ''; - # https://devenv.sh/languages/ - # languages.nix.enable = true; - - # https://devenv.sh/pre-commit-hooks/ - # pre-commit.hooks.shellcheck.enable = true; - - # https://devenv.sh/processes/ - # processes.ping.exec = "ping example.com"; - # See full reference at https://devenv.sh/reference/options/ } diff --git a/internal/utils/walk.go b/internal/utils/walk.go index 3a9e4fb..c7079fb 100644 --- a/internal/utils/walk.go +++ b/internal/utils/walk.go @@ -48,6 +48,7 @@ func Walk(source string) ([]string, error) { if err != nil { walkErrs = append(walkErrs, err) } + if !info.IsDir() { files = append(files, path) } diff --git a/plugins/ssh/cmds/create-key.go b/plugins/ssh/cmds/create-key.go index d19c4c9..4bc96c7 100644 --- a/plugins/ssh/cmds/create-key.go +++ b/plugins/ssh/cmds/create-key.go @@ -18,7 +18,7 @@ var CreateKey = &cobra.Command{ //nolint:gochecknoglobals // required by cobra Short: "create a SSH key", Long: `Perform secure SSH key generation. `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { p, err := utils.LoadPersona(cmd) if err != nil { ui.Fatal(err, 1) diff --git a/plugins/ssh/cmds/print-pubkey.go b/plugins/ssh/cmds/print-pubkey.go index e6ba96f..86b704f 100644 --- a/plugins/ssh/cmds/print-pubkey.go +++ b/plugins/ssh/cmds/print-pubkey.go @@ -15,7 +15,7 @@ var PrintPubKey = &cobra.Command{ //nolint:gochecknoglobals // required by cobra Short: "Print public key", Long: `Print SSH public key to be reused or copied outside of devid. `, - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { p, err := utils.LoadPersona(cmd) if err != nil { ui.Fatal(err, 1)