summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <[email protected]>2023-10-11 12:21:35 +0200
committerMarco Trevisan (Treviño) <[email protected]>2023-11-30 01:16:39 +0100
commit71620046687a14acad2ed49317d3003ac1fe84af (patch)
tree6e77e7c26fddd86c1a628e87470ecf140fd08c0c
parentadffdfbbdc356d1ff3a8e3b011a085eed0402062 (diff)
transaction: Do not make Transaction to implement error interface anymore
As per previous commit, Transaction can't be used anymore as an error value, but we instead we always return the status code.
-rw-r--r--transaction.go6
-rw-r--r--transaction_test.go2
2 files changed, 1 insertions, 7 deletions
diff --git a/transaction.go b/transaction.go
index 5957071..2809614 100644
--- a/transaction.go
+++ b/transaction.go
@@ -126,8 +126,6 @@ func cbPAMConv(s C.int, msg *C.char, c C.uintptr_t) (*C.char, C.int) {
}
// Transaction is the application's handle for a PAM transaction.
-//
-//nolint:errname
type Transaction struct {
handle *C.pam_handle_t
conv *C.struct_pam_conv
@@ -217,10 +215,6 @@ func start(service, user string, handler ConversationHandler, confDir string) (*
return t, nil
}
-func (t *Transaction) Error() string {
- return Error(t.lastStatus.Load()).Error()
-}
-
// Item is a an PAM information type.
type Item int
diff --git a/transaction_test.go b/transaction_test.go
index 62b4ce1..0e3a481 100644
--- a/transaction_test.go
+++ b/transaction_test.go
@@ -512,7 +512,7 @@ func Test_Error(t *testing.T) {
if err != nil {
var status Error
if !errors.As(err, &status) || err.Error() != status.Error() {
- t.Fatalf("error #unexpected status %v vs %v", err.Error(),
+ t.Fatalf("error #unexpected status %#v vs %#v", err.Error(),
status.Error())
}
}