This is an automated email from the ASF dual-hosted git repository.
hsluoyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/casbin.git
The following commit(s) were added to refs/heads/master by this push:
new c35c93d fix: update golangci-lint config for v2.15 and fix lint issues
c35c93d is described below
commit c35c93d29063b8bc3bc2ef30b09943d344a289f4
Author: Yang Luo <[email protected]>
AuthorDate: Wed Oct 21 08:39:25 2026 +0800
fix: update golangci-lint config for v2.15 and fix lint issues
---
.golangci.yml | 2 +-
conformance_test.go | 4 ++--
logger_test.go | 4 ++--
transaction_test.go | 6 +++---
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/.golangci.yml b/.golangci.yml
index a332bdb..77a44ea 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -64,7 +64,7 @@ linters:
exhaustive:
check:
- switch
- - map
+ - mapliteral
exhaustruct:
exclude:
- ^net/http.Client$
diff --git a/conformance_test.go b/conformance_test.go
index 5f5a039..3a729ac 100644
--- a/conformance_test.go
+++ b/conformance_test.go
@@ -230,8 +230,8 @@ func generateConformanceCases(t *testing.T) {
for i, v := range request {
rvals[i] = v
}
- allow, explain, err := e.EnforceEx(rvals...)
- if err != nil {
+ allow, explain, enforceErr := e.EnforceEx(rvals...)
+ if enforceErr != nil {
continue
}
if explain == nil {
diff --git a/logger_test.go b/logger_test.go
index 638a143..c44422a 100644
--- a/logger_test.go
+++ b/logger_test.go
@@ -37,7 +37,7 @@ func verifyBufferOutput(t *testing.T, logOutput string) {
func verifyCallbackEntries(t *testing.T, entries []*log.LogEntry) {
t.Helper()
- found := map[log.EventType]bool{}
+ found := make(map[log.EventType]bool)
for _, entry := range entries {
found[entry.EventType] = true
@@ -217,7 +217,7 @@ func verifySelectiveBufferOutput(t *testing.T, logOutput
string) {
func verifySelectiveCallbackEntries(t *testing.T, entries []*log.LogEntry) {
t.Helper()
- found := map[log.EventType]bool{}
+ found := make(map[log.EventType]bool)
for _, entry := range entries {
found[entry.EventType] = true
diff --git a/transaction_test.go b/transaction_test.go
index ad0292d..9fc042b 100644
--- a/transaction_test.go
+++ b/transaction_test.go
@@ -587,7 +587,7 @@ func TestTransactionCommitNotifiesWatcher(t *testing.T) {
updates := 0
watcher := &SampleWatcher{}
- if err := e.SetWatcher(watcher); err != nil {
+ if err = e.SetWatcher(watcher); err != nil {
t.Fatalf("Failed to set watcher: %v", err)
}
watcher.callback = func(string) { updates++ }
@@ -596,13 +596,13 @@ func TestTransactionCommitNotifiesWatcher(t *testing.T) {
if err != nil {
t.Fatalf("Failed to begin transaction: %v", err)
}
- if _, err := tx.AddPolicy("alice", "data1", "read"); err != nil {
+ if _, err = tx.AddPolicy("alice", "data1", "read"); err != nil {
t.Fatalf("Failed to add policy in transaction: %v", err)
}
if updates != 0 {
t.Fatalf("Watcher should not be notified before commit, got %d
updates", updates)
}
- if err := tx.Commit(); err != nil {
+ if err = tx.Commit(); err != nil {
t.Fatalf("Failed to commit transaction: %v", err)
}
if updates != 1 {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]