Skip to content

Commit eaefbdc

Browse files
committed
pam/adapter: Avoid using pointer receivers for Init functions
And other functions where we don't write to the models
1 parent bc820ea commit eaefbdc

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

pam/internal/adapter/authentication.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func newAuthenticationModel(client authd.PAMClient, clientType PamClientType) au
174174
}
175175

176176
// Init initializes authenticationModel.
177-
func (m *authenticationModel) Init() tea.Cmd {
177+
func (m authenticationModel) Init() tea.Cmd {
178178
return nil
179179
}
180180

pam/internal/adapter/authmodeselection.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func newAuthModeSelectionModel(clientType PamClientType) authModeSelectionModel
8383
}
8484

8585
// Init initializes authModeSelectionModel.
86-
func (m *authModeSelectionModel) Init() tea.Cmd {
86+
func (m authModeSelectionModel) Init() tea.Cmd {
8787
if m.clientType != InteractiveTerminal {
8888
// This is handled by the GDM or Native model!
8989
return nil

pam/internal/adapter/gdmmodel.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ type gdmIsAuthenticatedResultReceived isAuthenticatedResultReceived
4343
type gdmStopConversations struct{}
4444

4545
// Init initializes the main model orchestrator.
46-
func (m *gdmModel) Init() tea.Cmd {
46+
func (m gdmModel) Init() tea.Cmd {
4747
return tea.Sequence(m.protoHello(),
4848
requestUICapabilities(m.pamMTx),
4949
m.pollGdm())
5050
}
5151

52-
func (m *gdmModel) protoHello() tea.Cmd {
52+
func (m gdmModel) protoHello() tea.Cmd {
5353
reply, err := gdm.SendData(m.pamMTx, &gdm.Data{Type: gdm.DataType_hello})
5454
if err != nil {
5555
return sendEvent(pamError{
@@ -169,13 +169,13 @@ func (m *gdmModel) pollGdm() tea.Cmd {
169169
return tea.Sequence(commands...)
170170
}
171171

172-
func (m *gdmModel) emitEvent(event gdm.Event) tea.Cmd {
172+
func (m gdmModel) emitEvent(event gdm.Event) tea.Cmd {
173173
return func() tea.Msg {
174174
return m.emitEventSync(event)
175175
}
176176
}
177177

178-
func (m *gdmModel) emitEventSync(event gdm.Event) tea.Msg {
178+
func (m gdmModel) emitEventSync(event gdm.Event) tea.Msg {
179179
err := gdm.EmitEvent(m.pamMTx, event)
180180
log.Debug(context.TODO(), "EventSend", event, "result", err)
181181
if err != nil {

pam/internal/adapter/userselection.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func newUserSelectionModel(pamMTx pam.ModuleTransaction, clientType PamClientTyp
5858
}
5959

6060
// Init initializes userSelectionModel.
61-
func (m *userSelectionModel) Init() tea.Cmd {
61+
func (m userSelectionModel) Init() tea.Cmd {
6262
return nil
6363
}
6464

0 commit comments

Comments
 (0)