Skip to content

Commit 71483d8

Browse files
authored
pam/gdm: Redefine jsonProtoMessage type for go 1.24 (#808)
Fix the definition as it wouldn't work in newer go: ``` # github.com/ubuntu/authd/pam/internal/gdm [github.com/ubuntu/authd/pam/internal/gdm.test] ./extension.go:91:12: cannot define new methods on non-local type jsonProtoMessage ./extension.go:106:12: cannot define new methods on non-local type jsonProtoMessage ./extension.go:115:12: cannot define new methods on non-local type jsonProtoMessage ./extension.go:119:12: cannot define new methods on non-local type jsonProtoMessage ./extension.go:123:12: cannot define new methods on non-local type jsonProtoMessage ./extension.go:137:12: cannot define new methods on non-local type jsonProtoMessage FAIL github.com/ubuntu/authd/pam/internal/gdm [build failed] ``` See: golang/go#71917 UDENG-6160
2 parents af2c753 + 6148f83 commit 71483d8

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pam/internal/gdm/conversation.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package gdm
22

3-
import "C"
4-
53
import (
64
"context"
75
"errors"

pam/internal/gdm/extension.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func AdvertisePamExtensions(extensions []string) {
6868
C.gdm_extensions_advertise_supported(&cArray[0], C.size_t(len(extensions)))
6969
}
7070

71-
type jsonProtoMessage = C.GdmPamExtensionJSONProtocol
71+
type jsonProtoMessage C.GdmPamExtensionJSONProtocol
7272

7373
func allocateJSONProtoMessage() *jsonProtoMessage {
7474
// We do manual memory management here, instead of returning a go-allocated
@@ -100,7 +100,8 @@ func (msg *jsonProtoMessage) init(protoName string, protoVersion uint, jsonValue
100100
// them via finalizer functions.
101101
cJSON = (*C.char)(C.CBytes(append(jsonValue, 0)))
102102
}
103-
C.gdm_custom_json_request_init(msg, cProto, C.uint(protoVersion), cJSON)
103+
C.gdm_custom_json_request_init((*C.GdmPamExtensionJSONProtocol)(msg),
104+
cProto, C.uint(protoVersion), cJSON)
104105
}
105106

106107
func (msg *jsonProtoMessage) release() {

0 commit comments

Comments
 (0)