From 6fc7b8a916fb445ba239beb689081ddf7de7be17 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Thu, 6 Sep 2018 12:08:35 +0200 Subject: [PATCH] chore: fix lint warns --- pkg/config/config.go | 12 +-- pkg/config/host.go | 222 +++++++++++++++++++++---------------------- 2 files changed, 117 insertions(+), 117 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 8b2cff6c3..760d7cd4e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -74,7 +74,7 @@ func (c *Config) SaveNewKnownHost(target string) { } }() - fmt.Fprintln(file, target) + _, _ = fmt.Fprintln(file, target) } func (c *Config) addKnownHost(target string) { @@ -575,11 +575,11 @@ func (c *Config) WriteSSHConfigTo(w io.Writer) error { `) header = strings.Replace(header, "%VERSION", version.VERSION, -1) header = strings.Replace(header, "%BUILD_DATE", time.Now().Format("2006-01-02 15:04:05 -0700 MST"), -1) - fmt.Fprintln(w, header) + _, _ = fmt.Fprintln(w, header) // FIXME: add version - fmt.Fprintln(w) + _, _ = fmt.Fprintln(w) - fmt.Fprintln(w, "# host-based configuration") + _, _ = fmt.Fprintln(w, "# host-based configuration") for _, name := range c.sortedNames() { host := c.Hosts[name] computedHost, err := computeHost(host, c, name, false) @@ -589,10 +589,10 @@ func (c *Config) WriteSSHConfigTo(w io.Writer) error { if err = computedHost.WriteSSHConfigTo(w); err != nil { return err } - fmt.Fprintln(w) + _, _ = fmt.Fprintln(w) } - fmt.Fprintln(w, "# global configuration") + _, _ = fmt.Fprintln(w, "# global configuration") c.Defaults.name = "*" return c.Defaults.WriteSSHConfigTo(w) } diff --git a/pkg/config/host.go b/pkg/config/host.go index cfc40cf21..1931eee56 100644 --- a/pkg/config/host.go +++ b/pkg/config/host.go @@ -1098,347 +1098,347 @@ func (h *Host) WriteSSHConfigTo(w io.Writer) error { // FIXME: skip complex patterns if aliasIdx > 0 { - fmt.Fprint(w, "\n") + _, _ = fmt.Fprint(w, "\n") } - fmt.Fprintf(w, "Host %s\n", alias) + _, _ = fmt.Fprintf(w, "Host %s\n", alias) // ssh-config fields if h.AddKeysToAgent != "" { - fmt.Fprintf(w, " AddKeysToAgent %s\n", h.AddKeysToAgent) + _, _ = fmt.Fprintf(w, " AddKeysToAgent %s\n", h.AddKeysToAgent) } if h.AddressFamily != "" { - fmt.Fprintf(w, " AddressFamily %s\n", h.AddressFamily) + _, _ = fmt.Fprintf(w, " AddressFamily %s\n", h.AddressFamily) } if h.AskPassGUI != "" { - fmt.Fprintf(w, " AskPassGUI %s\n", h.AskPassGUI) + _, _ = fmt.Fprintf(w, " AskPassGUI %s\n", h.AskPassGUI) } if h.BatchMode != "" { - fmt.Fprintf(w, " BatchMode %s\n", h.BatchMode) + _, _ = fmt.Fprintf(w, " BatchMode %s\n", h.BatchMode) } if h.BindAddress != "" { - fmt.Fprintf(w, " BindAddress %s\n", h.BindAddress) + _, _ = fmt.Fprintf(w, " BindAddress %s\n", h.BindAddress) } if h.CanonicalDomains != "" { - fmt.Fprintf(w, " CanonicalDomains %s\n", h.CanonicalDomains) + _, _ = fmt.Fprintf(w, " CanonicalDomains %s\n", h.CanonicalDomains) } if h.CanonicalizeFallbackLocal != "" { - fmt.Fprintf(w, " CanonicalizeFallbackLocal %s\n", h.CanonicalizeFallbackLocal) + _, _ = fmt.Fprintf(w, " CanonicalizeFallbackLocal %s\n", h.CanonicalizeFallbackLocal) } if h.CanonicalizeHostname != "" { - fmt.Fprintf(w, " CanonicalizeHostname %s\n", h.CanonicalizeHostname) + _, _ = fmt.Fprintf(w, " CanonicalizeHostname %s\n", h.CanonicalizeHostname) } if h.CanonicalizeMaxDots != "" { - fmt.Fprintf(w, " CanonicalizeMaxDots %s\n", h.CanonicalizeMaxDots) + _, _ = fmt.Fprintf(w, " CanonicalizeMaxDots %s\n", h.CanonicalizeMaxDots) } if h.CanonicalizePermittedCNAMEs != "" { - fmt.Fprintf(w, " CanonicalizePermittedCNAMEs %s\n", h.CanonicalizePermittedCNAMEs) + _, _ = fmt.Fprintf(w, " CanonicalizePermittedCNAMEs %s\n", h.CanonicalizePermittedCNAMEs) } if h.ChallengeResponseAuthentication != "" { - fmt.Fprintf(w, " ChallengeResponseAuthentication %s\n", h.ChallengeResponseAuthentication) + _, _ = fmt.Fprintf(w, " ChallengeResponseAuthentication %s\n", h.ChallengeResponseAuthentication) } if h.CheckHostIP != "" { - fmt.Fprintf(w, " CheckHostIP %s\n", h.CheckHostIP) + _, _ = fmt.Fprintf(w, " CheckHostIP %s\n", h.CheckHostIP) } if h.Cipher != "" { - fmt.Fprintf(w, " Cipher %s\n", h.Cipher) + _, _ = fmt.Fprintf(w, " Cipher %s\n", h.Cipher) } if len(h.Ciphers) > 0 { - fmt.Fprintf(w, " Ciphers %s\n", strings.Join(h.Ciphers, ",")) + _, _ = fmt.Fprintf(w, " Ciphers %s\n", strings.Join(h.Ciphers, ",")) } if h.ClearAllForwardings != "" { - fmt.Fprintf(w, " ClearAllForwardings %s\n", h.ClearAllForwardings) + _, _ = fmt.Fprintf(w, " ClearAllForwardings %s\n", h.ClearAllForwardings) } if h.Compression != "" { - fmt.Fprintf(w, " Compression %s\n", h.Compression) + _, _ = fmt.Fprintf(w, " Compression %s\n", h.Compression) } if h.CompressionLevel != 0 { - fmt.Fprintf(w, " CompressionLevel %d\n", h.CompressionLevel) + _, _ = fmt.Fprintf(w, " CompressionLevel %d\n", h.CompressionLevel) } if h.ConnectionAttempts != "" { - fmt.Fprintf(w, " ConnectionAttempts %s\n", h.ConnectionAttempts) + _, _ = fmt.Fprintf(w, " ConnectionAttempts %s\n", h.ConnectionAttempts) } if h.ConnectTimeout != 0 { - fmt.Fprintf(w, " ConnectTimeout %d\n", h.ConnectTimeout) + _, _ = fmt.Fprintf(w, " ConnectTimeout %d\n", h.ConnectTimeout) } if h.ControlMaster != "" { - fmt.Fprintf(w, " ControlMaster %s\n", h.ControlMaster) + _, _ = fmt.Fprintf(w, " ControlMaster %s\n", h.ControlMaster) } if h.ControlPath != "" { - fmt.Fprintf(w, " ControlPath %s\n", h.ControlPath) + _, _ = fmt.Fprintf(w, " ControlPath %s\n", h.ControlPath) } if h.ControlPersist != "" { - fmt.Fprintf(w, " ControlPersist %s\n", h.ControlPersist) + _, _ = fmt.Fprintf(w, " ControlPersist %s\n", h.ControlPersist) } for _, entry := range h.DynamicForward { - fmt.Fprintf(w, " DynamicForward %s\n", entry) + _, _ = fmt.Fprintf(w, " DynamicForward %s\n", entry) } if h.EnableSSHKeysign != "" { - fmt.Fprintf(w, " EnableSSHKeysign %s\n", h.EnableSSHKeysign) + _, _ = fmt.Fprintf(w, " EnableSSHKeysign %s\n", h.EnableSSHKeysign) } if h.EscapeChar != "" { - fmt.Fprintf(w, " EscapeChar %s\n", h.EscapeChar) + _, _ = fmt.Fprintf(w, " EscapeChar %s\n", h.EscapeChar) } if h.ExitOnForwardFailure != "" { - fmt.Fprintf(w, " ExitOnForwardFailure %s\n", h.ExitOnForwardFailure) + _, _ = fmt.Fprintf(w, " ExitOnForwardFailure %s\n", h.ExitOnForwardFailure) } if h.FingerprintHash != "" { - fmt.Fprintf(w, " FingerprintHash %s\n", h.FingerprintHash) + _, _ = fmt.Fprintf(w, " FingerprintHash %s\n", h.FingerprintHash) } if h.ForwardAgent != "" { - fmt.Fprintf(w, " ForwardAgent %s\n", h.ForwardAgent) + _, _ = fmt.Fprintf(w, " ForwardAgent %s\n", h.ForwardAgent) } if h.ForwardX11 != "" { - fmt.Fprintf(w, " ForwardX11 %s\n", h.ForwardX11) + _, _ = fmt.Fprintf(w, " ForwardX11 %s\n", h.ForwardX11) } if h.ForwardX11Timeout != 0 { - fmt.Fprintf(w, " ForwardX11Timeout %d\n", h.ForwardX11Timeout) + _, _ = fmt.Fprintf(w, " ForwardX11Timeout %d\n", h.ForwardX11Timeout) } if h.ForwardX11Trusted != "" { - fmt.Fprintf(w, " ForwardX11Trusted %s\n", h.ForwardX11Trusted) + _, _ = fmt.Fprintf(w, " ForwardX11Trusted %s\n", h.ForwardX11Trusted) } if h.GatewayPorts != "" { - fmt.Fprintf(w, " GatewayPorts %s\n", h.GatewayPorts) + _, _ = fmt.Fprintf(w, " GatewayPorts %s\n", h.GatewayPorts) } if len(h.GlobalKnownHostsFile) > 0 { - fmt.Fprintf(w, " GlobalKnownHostsFile %s\n", strings.Join(h.GlobalKnownHostsFile, " ")) + _, _ = fmt.Fprintf(w, " GlobalKnownHostsFile %s\n", strings.Join(h.GlobalKnownHostsFile, " ")) } if h.GSSAPIAuthentication != "" { - fmt.Fprintf(w, " GSSAPIAuthentication %s\n", h.GSSAPIAuthentication) + _, _ = fmt.Fprintf(w, " GSSAPIAuthentication %s\n", h.GSSAPIAuthentication) } if h.GSSAPIClientIdentity != "" { - fmt.Fprintf(w, " GSSAPIClientIdentity %s\n", h.GSSAPIClientIdentity) + _, _ = fmt.Fprintf(w, " GSSAPIClientIdentity %s\n", h.GSSAPIClientIdentity) } if h.GSSAPIDelegateCredentials != "" { - fmt.Fprintf(w, " GSSAPIDelegateCredentials %s\n", h.GSSAPIDelegateCredentials) + _, _ = fmt.Fprintf(w, " GSSAPIDelegateCredentials %s\n", h.GSSAPIDelegateCredentials) } if h.GSSAPIKeyExchange != "" { - fmt.Fprintf(w, " GSSAPIKeyExchange %s\n", h.GSSAPIKeyExchange) + _, _ = fmt.Fprintf(w, " GSSAPIKeyExchange %s\n", h.GSSAPIKeyExchange) } if h.GSSAPIRenewalForcesRekey != "" { - fmt.Fprintf(w, " GSSAPIRenewalForcesRekey %s\n", h.GSSAPIRenewalForcesRekey) + _, _ = fmt.Fprintf(w, " GSSAPIRenewalForcesRekey %s\n", h.GSSAPIRenewalForcesRekey) } if h.GSSAPIServerIdentity != "" { - fmt.Fprintf(w, " GSSAPIServerIdentity %s\n", h.GSSAPIServerIdentity) + _, _ = fmt.Fprintf(w, " GSSAPIServerIdentity %s\n", h.GSSAPIServerIdentity) } if h.GSSAPITrustDNS != "" { - fmt.Fprintf(w, " GSSAPITrustDNS %s\n", h.GSSAPITrustDNS) + _, _ = fmt.Fprintf(w, " GSSAPITrustDNS %s\n", h.GSSAPITrustDNS) } if h.HashKnownHosts != "" { - fmt.Fprintf(w, " HashKnownHosts %s\n", h.HashKnownHosts) + _, _ = fmt.Fprintf(w, " HashKnownHosts %s\n", h.HashKnownHosts) } if h.HostbasedAuthentication != "" { - fmt.Fprintf(w, " HostbasedAuthentication %s\n", h.HostbasedAuthentication) + _, _ = fmt.Fprintf(w, " HostbasedAuthentication %s\n", h.HostbasedAuthentication) } if h.HostbasedKeyTypes != "" { - fmt.Fprintf(w, " HostbasedKeyTypes %s\n", h.HostbasedKeyTypes) + _, _ = fmt.Fprintf(w, " HostbasedKeyTypes %s\n", h.HostbasedKeyTypes) } if h.HostKeyAlgorithms != "" { - fmt.Fprintf(w, " HostKeyAlgorithms %s\n", h.HostKeyAlgorithms) + _, _ = fmt.Fprintf(w, " HostKeyAlgorithms %s\n", h.HostKeyAlgorithms) } if h.HostKeyAlias != "" { - fmt.Fprintf(w, " HostKeyAlias %s\n", h.HostKeyAlias) + _, _ = fmt.Fprintf(w, " HostKeyAlias %s\n", h.HostKeyAlias) } if h.IdentitiesOnly != "" { - fmt.Fprintf(w, " IdentitiesOnly %s\n", h.IdentitiesOnly) + _, _ = fmt.Fprintf(w, " IdentitiesOnly %s\n", h.IdentitiesOnly) } for _, entry := range h.IdentityFile { - fmt.Fprintf(w, " IdentityFile %s\n", entry) + _, _ = fmt.Fprintf(w, " IdentityFile %s\n", entry) } if h.IgnoreUnknown != "" { - fmt.Fprintf(w, " IgnoreUnknown %s\n", h.IgnoreUnknown) + _, _ = fmt.Fprintf(w, " IgnoreUnknown %s\n", h.IgnoreUnknown) } if len(h.IPQoS) > 0 { - fmt.Fprintf(w, " IPQoS %s\n", strings.Join(h.IPQoS, " ")) + _, _ = fmt.Fprintf(w, " IPQoS %s\n", strings.Join(h.IPQoS, " ")) } if h.KbdInteractiveAuthentication != "" { - fmt.Fprintf(w, " KbdInteractiveAuthentication %s\n", h.KbdInteractiveAuthentication) + _, _ = fmt.Fprintf(w, " KbdInteractiveAuthentication %s\n", h.KbdInteractiveAuthentication) } if len(h.KbdInteractiveDevices) > 0 { - fmt.Fprintf(w, " KbdInteractiveDevices %s\n", strings.Join(h.KbdInteractiveDevices, ",")) + _, _ = fmt.Fprintf(w, " KbdInteractiveDevices %s\n", strings.Join(h.KbdInteractiveDevices, ",")) } if len(h.KexAlgorithms) > 0 { - fmt.Fprintf(w, " KexAlgorithms %s\n", strings.Join(h.KexAlgorithms, ",")) + _, _ = fmt.Fprintf(w, " KexAlgorithms %s\n", strings.Join(h.KexAlgorithms, ",")) } if h.KeychainIntegration != "" { - fmt.Fprintf(w, " KeychainIntegration %s\n", h.KeychainIntegration) + _, _ = fmt.Fprintf(w, " KeychainIntegration %s\n", h.KeychainIntegration) } if h.LocalCommand != "" { - fmt.Fprintf(w, " LocalCommand %s\n", h.LocalCommand) + _, _ = fmt.Fprintf(w, " LocalCommand %s\n", h.LocalCommand) } for _, entry := range h.LocalForward { - fmt.Fprintf(w, " LocalForward %s\n", entry) + _, _ = fmt.Fprintf(w, " LocalForward %s\n", entry) } if h.LogLevel != "" { - fmt.Fprintf(w, " LogLevel %s\n", h.LogLevel) + _, _ = fmt.Fprintf(w, " LogLevel %s\n", h.LogLevel) } if len(h.MACs) > 0 { - fmt.Fprintf(w, " MACs %s\n", strings.Join(h.MACs, ",")) + _, _ = fmt.Fprintf(w, " MACs %s\n", strings.Join(h.MACs, ",")) } if h.Match != "" { - fmt.Fprintf(w, " Match %s\n", h.Match) + _, _ = fmt.Fprintf(w, " Match %s\n", h.Match) } if h.NoHostAuthenticationForLocalhost != "" { - fmt.Fprintf(w, " NoHostAuthenticationForLocalhost %s\n", h.NoHostAuthenticationForLocalhost) + _, _ = fmt.Fprintf(w, " NoHostAuthenticationForLocalhost %s\n", h.NoHostAuthenticationForLocalhost) } if h.NumberOfPasswordPrompts != "" { - fmt.Fprintf(w, " NumberOfPasswordPrompts %s\n", h.NumberOfPasswordPrompts) + _, _ = fmt.Fprintf(w, " NumberOfPasswordPrompts %s\n", h.NumberOfPasswordPrompts) } if h.PasswordAuthentication != "" { - fmt.Fprintf(w, " PasswordAuthentication %s\n", h.PasswordAuthentication) + _, _ = fmt.Fprintf(w, " PasswordAuthentication %s\n", h.PasswordAuthentication) } if h.PermitLocalCommand != "" { - fmt.Fprintf(w, " PermitLocalCommand %s\n", h.PermitLocalCommand) + _, _ = fmt.Fprintf(w, " PermitLocalCommand %s\n", h.PermitLocalCommand) } if h.PKCS11Provider != "" { - fmt.Fprintf(w, " PKCS11Provider %s\n", h.PKCS11Provider) + _, _ = fmt.Fprintf(w, " PKCS11Provider %s\n", h.PKCS11Provider) } if h.Port != "" { - fmt.Fprintf(w, " Port %s\n", h.Port) + _, _ = fmt.Fprintf(w, " Port %s\n", h.Port) } if h.PreferredAuthentications != "" { - fmt.Fprintf(w, " PreferredAuthentications %s\n", h.PreferredAuthentications) + _, _ = fmt.Fprintf(w, " PreferredAuthentications %s\n", h.PreferredAuthentications) } if len(h.Protocol) > 0 { - fmt.Fprintf(w, " Protocol %s\n", strings.Join(h.Protocol, ",")) + _, _ = fmt.Fprintf(w, " Protocol %s\n", strings.Join(h.Protocol, ",")) } if h.ProxyUseFdpass != "" { - fmt.Fprintf(w, " ProxyUseFdpass %s\n", h.ProxyUseFdpass) + _, _ = fmt.Fprintf(w, " ProxyUseFdpass %s\n", h.ProxyUseFdpass) } if h.PubkeyAcceptedKeyTypes != "" { - fmt.Fprintf(w, " PubkeyAcceptedKeyTypes %s\n", h.PubkeyAcceptedKeyTypes) + _, _ = fmt.Fprintf(w, " PubkeyAcceptedKeyTypes %s\n", h.PubkeyAcceptedKeyTypes) } if h.PubkeyAuthentication != "" { - fmt.Fprintf(w, " PubkeyAuthentication %s\n", h.PubkeyAuthentication) + _, _ = fmt.Fprintf(w, " PubkeyAuthentication %s\n", h.PubkeyAuthentication) } if h.RekeyLimit != "" { - fmt.Fprintf(w, " RekeyLimit %s\n", h.RekeyLimit) + _, _ = fmt.Fprintf(w, " RekeyLimit %s\n", h.RekeyLimit) } for _, entry := range h.RemoteForward { - fmt.Fprintf(w, " RemoteForward %s\n", entry) + _, _ = fmt.Fprintf(w, " RemoteForward %s\n", entry) } if h.RequestTTY != "" { - fmt.Fprintf(w, " RequestTTY %s\n", h.RequestTTY) + _, _ = fmt.Fprintf(w, " RequestTTY %s\n", h.RequestTTY) } if h.RevokedHostKeys != "" { - fmt.Fprintf(w, " RevokedHostKeys %s\n", h.RevokedHostKeys) + _, _ = fmt.Fprintf(w, " RevokedHostKeys %s\n", h.RevokedHostKeys) } if h.RhostsRSAAuthentication != "" { - fmt.Fprintf(w, " RhostsRSAAuthentication %s\n", h.RhostsRSAAuthentication) + _, _ = fmt.Fprintf(w, " RhostsRSAAuthentication %s\n", h.RhostsRSAAuthentication) } if h.RSAAuthentication != "" { - fmt.Fprintf(w, " RSAAuthentication %s\n", h.RSAAuthentication) + _, _ = fmt.Fprintf(w, " RSAAuthentication %s\n", h.RSAAuthentication) } for _, entry := range h.SendEnv { - fmt.Fprintf(w, " SendEnv %s\n", entry) + _, _ = fmt.Fprintf(w, " SendEnv %s\n", entry) } if h.ServerAliveCountMax != 0 { - fmt.Fprintf(w, " ServerAliveCountMax %d\n", h.ServerAliveCountMax) + _, _ = fmt.Fprintf(w, " ServerAliveCountMax %d\n", h.ServerAliveCountMax) } if h.ServerAliveInterval != 0 { - fmt.Fprintf(w, " ServerAliveInterval %d\n", h.ServerAliveInterval) + _, _ = fmt.Fprintf(w, " ServerAliveInterval %d\n", h.ServerAliveInterval) } if h.StreamLocalBindMask != "" { - fmt.Fprintf(w, " StreamLocalBindMask %s\n", h.StreamLocalBindMask) + _, _ = fmt.Fprintf(w, " StreamLocalBindMask %s\n", h.StreamLocalBindMask) } if h.StreamLocalBindUnlink != "" { - fmt.Fprintf(w, " StreamLocalBindUnlink %s\n", h.StreamLocalBindUnlink) + _, _ = fmt.Fprintf(w, " StreamLocalBindUnlink %s\n", h.StreamLocalBindUnlink) } if h.StrictHostKeyChecking != "" { - fmt.Fprintf(w, " StrictHostKeyChecking %s\n", h.StrictHostKeyChecking) + _, _ = fmt.Fprintf(w, " StrictHostKeyChecking %s\n", h.StrictHostKeyChecking) } if h.TCPKeepAlive != "" { - fmt.Fprintf(w, " TCPKeepAlive %s\n", h.TCPKeepAlive) + _, _ = fmt.Fprintf(w, " TCPKeepAlive %s\n", h.TCPKeepAlive) } if h.Tunnel != "" { - fmt.Fprintf(w, " Tunnel %s\n", h.Tunnel) + _, _ = fmt.Fprintf(w, " Tunnel %s\n", h.Tunnel) } if h.TunnelDevice != "" { - fmt.Fprintf(w, " TunnelDevice %s\n", h.TunnelDevice) + _, _ = fmt.Fprintf(w, " TunnelDevice %s\n", h.TunnelDevice) } if h.UpdateHostKeys != "" { - fmt.Fprintf(w, " UpdateHostKeys %s\n", h.UpdateHostKeys) + _, _ = fmt.Fprintf(w, " UpdateHostKeys %s\n", h.UpdateHostKeys) } if h.UseKeychain != "" { - fmt.Fprintf(w, " UseKeychain %s\n", h.UseKeychain) + _, _ = fmt.Fprintf(w, " UseKeychain %s\n", h.UseKeychain) } if h.UsePrivilegedPort != "" { - fmt.Fprintf(w, " UsePrivilegedPort %s\n", h.UsePrivilegedPort) + _, _ = fmt.Fprintf(w, " UsePrivilegedPort %s\n", h.UsePrivilegedPort) } if h.User != "" { - fmt.Fprintf(w, " User %s\n", h.User) + _, _ = fmt.Fprintf(w, " User %s\n", h.User) } if len(h.UserKnownHostsFile) > 0 { - fmt.Fprintf(w, " UserKnownHostsFile %s\n", strings.Join(h.UserKnownHostsFile, " ")) + _, _ = fmt.Fprintf(w, " UserKnownHostsFile %s\n", strings.Join(h.UserKnownHostsFile, " ")) } if h.VerifyHostKeyDNS != "" { - fmt.Fprintf(w, " VerifyHostKeyDNS %s\n", h.VerifyHostKeyDNS) + _, _ = fmt.Fprintf(w, " VerifyHostKeyDNS %s\n", h.VerifyHostKeyDNS) } if h.VisualHostKey != "" { - fmt.Fprintf(w, " VisualHostKey %s\n", h.VisualHostKey) + _, _ = fmt.Fprintf(w, " VisualHostKey %s\n", h.VisualHostKey) } if h.XAuthLocation != "" { - fmt.Fprintf(w, " XAuthLocation %s\n", h.XAuthLocation) + _, _ = fmt.Fprintf(w, " XAuthLocation %s\n", h.XAuthLocation) } // ssh-config fields with a different behavior if h.isDefault { if h.noAutomaticRewrite { - fmt.Fprintf(w, " ProxyCommand %s connect --no-rewrite --port=%%p %%h\n", asshBinaryPath) + _, _ = fmt.Fprintf(w, " ProxyCommand %s connect --no-rewrite --port=%%p %%h\n", asshBinaryPath) } else { - fmt.Fprintf(w, " ProxyCommand %s connect --port=%%p %%h\n", asshBinaryPath) + _, _ = fmt.Fprintf(w, " ProxyCommand %s connect --port=%%p %%h\n", asshBinaryPath) } } else { if h.ProxyCommand != "" { - fmt.Fprintf(w, " # ProxyCommand %s\n", h.ProxyCommand) + _, _ = fmt.Fprintf(w, " # ProxyCommand %s\n", h.ProxyCommand) } } // assh fields if h.HostName != "" { - fmt.Fprint(w, stringComment("HostName", h.HostName)) + _, _ = fmt.Fprint(w, stringComment("HostName", h.HostName)) } if BoolVal(h.ControlMasterMkdir) { - fmt.Fprint(w, " # ControlMasterMkdir: true\n") + _, _ = fmt.Fprint(w, " # ControlMasterMkdir: true\n") } if len(h.Inherits) > 0 { - fmt.Fprint(w, sliceComment("Inherits", h.Inherits)) + _, _ = fmt.Fprint(w, sliceComment("Inherits", h.Inherits)) } if len(h.Gateways) > 0 { - fmt.Fprint(w, sliceComment("Gateways", h.Gateways)) + _, _ = fmt.Fprint(w, sliceComment("Gateways", h.Gateways)) } if len(h.Comment) > 0 { - fmt.Fprint(w, sliceComment("Comment", h.Comment)) + _, _ = fmt.Fprint(w, sliceComment("Comment", h.Comment)) } if h.GatewayConnectTimeout > 0 { - fmt.Fprint(w, stringComment("GatewayConnectTimeout", fmt.Sprintf("%d", h.GatewayConnectTimeout))) + _, _ = fmt.Fprint(w, stringComment("GatewayConnectTimeout", fmt.Sprintf("%d", h.GatewayConnectTimeout))) } if len(h.Aliases) > 0 { if aliasIdx == 0 { - fmt.Fprint(w, sliceComment("Aliases", h.Aliases)) + _, _ = fmt.Fprint(w, sliceComment("Aliases", h.Aliases)) } else { - fmt.Fprint(w, stringComment("AliasOf", h.Name())) + _, _ = fmt.Fprint(w, stringComment("AliasOf", h.Name())) } } if h.Hooks.Length() > 0 { - fmt.Fprint(w, stringComment("Hooks", h.Hooks.String())) + _, _ = fmt.Fprint(w, stringComment("Hooks", h.Hooks.String())) } if len(h.knownHosts) > 0 { if aliasIdx == 0 { - fmt.Fprint(w, sliceComment("KnownHosts", h.knownHosts)) + _, _ = fmt.Fprint(w, sliceComment("KnownHosts", h.knownHosts)) } else { - fmt.Fprint(w, stringComment("KnownHostOf", h.Name())) + _, _ = fmt.Fprint(w, stringComment("KnownHostOf", h.Name())) } } if len(h.ResolveNameservers) > 0 { - fmt.Fprint(w, sliceComment("ResolveNameservers", h.ResolveNameservers)) + _, _ = fmt.Fprint(w, sliceComment("ResolveNameservers", h.ResolveNameservers)) } if h.ResolveCommand != "" { - fmt.Fprint(w, stringComment("ResolveCommand", h.ResolveCommand)) + _, _ = fmt.Fprint(w, stringComment("ResolveCommand", h.ResolveCommand)) } if h.RateLimit != "" { - fmt.Fprint(w, stringComment("RateLimit", h.RateLimit)) + _, _ = fmt.Fprint(w, stringComment("RateLimit", h.RateLimit)) } aliasIdx++