From 7ecd143b81fb097ad8207383bfc2d904a34cc422 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Mon, 9 Feb 2026 21:12:09 -0500 Subject: [PATCH] Use updated "new()" behavior from Go 1.26 --- core/init.go | 12 ++++-------- go.mod | 2 +- synccommon/common.go | 3 +-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/core/init.go b/core/init.go index d57256d..8fc3ed4 100644 --- a/core/init.go +++ b/core/init.go @@ -39,8 +39,7 @@ func LibmuttonInit(inputCB func(prompt string) string, rcwPassword []byte, appen } // write config file - offlineMode := true - newCfg.Libmutton.OfflineMode = &offlineMode + newCfg.Libmutton.OfflineMode = new(true) if err = config.Write(newCfg, false); err != nil { return err } @@ -59,9 +58,6 @@ func LibmuttonInit(inputCB func(prompt string) string, rcwPassword []byte, appen if len(r) > 0 && r[0] == 'y' { sshKeyProtected = true } - sshUser := inputCB("Remote SSH username:") - sshIP := inputCB("Remote SSH IP/domain:") - sshPort := inputCB("Remote SSH port:") // perform operations based on collected user input //// initialize libmutton directories @@ -72,9 +68,9 @@ func LibmuttonInit(inputCB func(prompt string) string, rcwPassword []byte, appen //// write config file //// temporarily leave sshEntryRootPath, sshAgeDirPath, and sshIsWindows as nil/default to pass initial device ID registration newCfg.Libmutton.OfflineMode = &forceOfflineMode // forceOfflineMode must be false to reach this point, so we can avoid the extra declaration - newCfg.Libmutton.SSHUser = &sshUser - newCfg.Libmutton.SSHIP = &sshIP - newCfg.Libmutton.SSHPort = &sshPort + newCfg.Libmutton.SSHUser = new(inputCB("Remote SSH username:")) + newCfg.Libmutton.SSHIP = new(inputCB("Remote SSH IP/domain:")) + newCfg.Libmutton.SSHPort = new(inputCB("Remote SSH port:")) newCfg.Libmutton.SSHKeyPath = &sshKeyPath newCfg.Libmutton.SSHKeyProtected = &sshKeyProtected if err = config.Write(newCfg, appendMode); err != nil { // pass appendMode to allow not completely destroying existing (client-specific) config diff --git a/go.mod b/go.mod index 1aa50d8..684ac30 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/rwinkhart/libmutton -go 1.25.7 +go 1.26rc3 require ( github.com/pkg/sftp v1.13.10 diff --git a/synccommon/common.go b/synccommon/common.go index 3bf9794..63dfc06 100644 --- a/synccommon/common.go +++ b/synccommon/common.go @@ -67,8 +67,7 @@ func GetAllEntryData() (EntryMapT, error) { ageInfo, err = os.Stat(global.GetRealAgePath(vanityPath)) var ageTimestamp *int64 if err == nil { - ageTime := ageInfo.ModTime().Unix() - ageTimestamp = &ageTime + ageTimestamp = new(ageInfo.ModTime().Unix()) } else if !os.IsNotExist(err) { return nil, errors.New("unable to read age time for " + vanityPath + ": " + err.Error()) }