Use updated "new()" behavior from Go 1.26

This commit is contained in:
2026-02-09 21:12:09 -05:00
parent 9c0ed69d7f
commit 7ecd143b81
3 changed files with 6 additions and 11 deletions
+4 -8
View File
@@ -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
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/rwinkhart/libmutton
go 1.25.7
go 1.26rc3
require (
github.com/pkg/sftp v1.13.10
+1 -2
View File
@@ -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())
}