From 8bfd0493b2690df65ae13cf2c2a59689555631b8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 25 Aug 2024 15:51:34 +0200 Subject: [PATCH] fix(deps): update golangci --- .drone.yml | 4 ++-- .golangci.yml | 4 ++++ devenv.lock | 24 ++++++++++++------------ pkg/cmd/user.go | 4 ++-- pkg/db/test.go | 16 ++++++++-------- pkg/user/user_test.go | 2 +- 6 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.drone.yml b/.drone.yml index ca4d9ba76..b259470bd 100644 --- a/.drone.yml +++ b/.drone.yml @@ -139,7 +139,7 @@ steps: event: [ push, tag, pull_request ] - name: api-lint - image: golangci/golangci-lint:v1.59.1 + image: golangci/golangci-lint:v1.60.3 pull: always environment: GOPROXY: 'https://goproxy.kolaente.de' @@ -1352,6 +1352,6 @@ steps: - failure --- kind: signature -hmac: dc96a5f8aaa332b35fc02f1b8566493e494452d62bed52973d804f5347ae47ae +hmac: 715c2bd948ee16e3a109e5dbf1377a3b3c1f61fae20d7ab299b6b47fbc5e9c6a ... diff --git a/.golangci.yml b/.golangci.yml index 94cb689e8..5e227f321 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -109,3 +109,7 @@ issues: text: 'structtag: struct field Position repeats json tag "position" also at' linters: - govet + - path: pkg/cmd/user.go + text: 'G115: integer overflow conversion uintptr -> int' + linters: + - gosec diff --git a/devenv.lock b/devenv.lock index bbdd100a4..4109fd3f8 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,11 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1723409744, + "lastModified": 1724504184, "owner": "cachix", "repo": "devenv", - "rev": "116159a4bfeaa79662f4c39dbfaf2fce6a5737f7", - "treeHash": "ccbae63055f83e669996a88a3cbb4ef69febd002", + "rev": "51338b58fd666f448db7486ec145dbe52db9b829", + "treeHash": "cedf6d41b00189dfd5132772cb5f35fcb10a7f7b", "type": "github" }, "original": { @@ -72,11 +72,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1723282977, + "lastModified": 1724316499, "owner": "NixOS", "repo": "nixpkgs", - "rev": "a781ff33ae258bbcfd4ed6e673860c3e923bf2cc", - "treeHash": "75cf71293251c603e56d6076098346b4128b2ec8", + "rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841", + "treeHash": "fe60fe6585f3b84f2ee7fcbf10f02f02fc5c54ca", "type": "github" }, "original": { @@ -88,11 +88,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1723175592, + "lastModified": 1724224976, "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e0ca22929f3342b19569b21b2f3462f053e497b", - "treeHash": "a6b38d5232ae0ae0c666c37f5ec9620c14f30369", + "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", + "treeHash": "1b707e2dd1830bf99c662e1a1694c5c463d8026b", "type": "github" }, "original": { @@ -112,11 +112,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1723202784, + "lastModified": 1724440431, "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "c7012d0c18567c889b948781bc74a501e92275d1", - "treeHash": "0016d5d748d61d3bfaa69d3c02abff74740a46b7", + "rev": "c8a54057aae480c56e28ef3e14e4960628ac495b", + "treeHash": "40ee1da550348c789ed9503eea365533a618506c", "type": "github" }, "original": { diff --git a/pkg/cmd/user.go b/pkg/cmd/user.go index aaaa78027..8b4521bb4 100644 --- a/pkg/cmd/user.go +++ b/pkg/cmd/user.go @@ -24,13 +24,13 @@ import ( "strings" "time" - "github.com/asaskevich/govalidator" - "code.vikunja.io/api/pkg/db" "code.vikunja.io/api/pkg/initialize" "code.vikunja.io/api/pkg/log" "code.vikunja.io/api/pkg/models" "code.vikunja.io/api/pkg/user" + + "github.com/asaskevich/govalidator" "github.com/olekukonko/tablewriter" "github.com/spf13/cobra" "golang.org/x/term" diff --git a/pkg/db/test.go b/pkg/db/test.go index 4ca27c86e..ae06126b8 100644 --- a/pkg/db/test.go +++ b/pkg/db/test.go @@ -94,16 +94,16 @@ func AssertExists(t *testing.T, table string, values map[string]interface{}, cus } else { exists, err = x.Table(table).Where(values).Get(&v) } - require.NoError(t, err, fmt.Sprintf("Failed to assert entries exist in db, error was: %s", err)) + require.NoError(t, err, "Failed to assert entries exist in db") if !exists { all := []map[string]interface{}{} err = x.Table(table).Find(&all) - require.NoError(t, err, fmt.Sprintf("Failed to assert entries exist in db, error was: %s", err)) + require.NoErrorf(t, err, "Failed to assert entries exist in db, error was: %s", err) pretty, err := json.MarshalIndent(all, "", " ") - require.NoError(t, err, fmt.Sprintf("Failed to assert entries exist in db, error was: %s", err)) + require.NoErrorf(t, err, "Failed to assert entries exist in db, error was: %s", err) - t.Errorf(fmt.Sprintf("Entries %v do not exist in table %s\n\nFound entries instead: %v", values, table, string(pretty))) + t.Errorf("Entries %v do not exist in table %s\n\nFound entries instead: %v", values, table, string(pretty)) } } @@ -111,13 +111,13 @@ func AssertExists(t *testing.T, table string, values map[string]interface{}, cus func AssertMissing(t *testing.T, table string, values map[string]interface{}) { v := make(map[string]interface{}) exists, err := x.Table(table).Where(values).Exist(&v) - require.NoError(t, err, fmt.Sprintf("Failed to assert entries don't exist in db, error was: %s", err)) - assert.False(t, exists, fmt.Sprintf("Entries %v exist in table %s", values, table)) + require.NoErrorf(t, err, "Failed to assert entries don't exist in db, error was: %s", err) + assert.Falsef(t, exists, "Entries %v exist in table %s", values, table) } // AssertCount checks if a number of entries exists in the database func AssertCount(t *testing.T, table string, where builder.Cond, count int64) { dbCount, err := x.Table(table).Where(where).Count() - require.NoError(t, err, fmt.Sprintf("Failed to assert count in db, error was: %s", err)) - assert.Equal(t, count, dbCount, fmt.Sprintf("Found %d entries instead of expected %d in table %s", dbCount, count, table)) + require.NoErrorf(t, err, "Failed to assert count in db, error was: %s", err) + assert.Equalf(t, count, dbCount, "Found %d entries instead of expected %d in table %s", dbCount, count, table) } diff --git a/pkg/user/user_test.go b/pkg/user/user_test.go index f7ef9b139..bf7507715 100644 --- a/pkg/user/user_test.go +++ b/pkg/user/user_test.go @@ -390,7 +390,7 @@ func TestListUsers(t *testing.T) { all, err := ListUsers(s, "uSEr1", nil) require.NoError(t, err) - assert.NotEmpty(t, len(all)) + assert.NotEmpty(t, all) assert.Equal(t, "user1", all[0].Username) }) t.Run("all users", func(t *testing.T) {