File go1.x-prefer-etc-hosts-over-dns.patch of Package go1.14.17895

From: Richard Brown <rbrownccb@opensuse.org>
Date: Fri, 12 Jun 2020 14:21:56 +0200
Subject: net: prefer /etc/hosts over DNS when no /etc/nsswitch.conf is present
References: gh#golang/go#35305 boo#1172868
Upstream: submitted

go standard library package net assumes file /etc/nsswitch.conf and does not
honor /usr/etc/nssswitch.conf location used in openSUSE. Upstream is reviewing a
fix to remove invalid the glibc DNS resolution assumption for go1.16 release
cycle scheduled for Februay 2021.

---
 src/net/conf.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/net/conf.go b/src/net/conf.go
index 971b1a399a..f8f9aa70e4 100644
--- a/src/net/conf.go
+++ b/src/net/conf.go
@@ -203,9 +203,8 @@ func (c *conf) hostLookupOrder(r *Resolver, hostname string) (ret hostLookupOrde
 			return fallbackOrder
 		}
 		if c.goos == "linux" {
-			// glibc says the default is "dns [!UNAVAIL=return] files"
-			// https://www.gnu.org/software/libc/manual/html_node/Notes-on-NSS-Configuration-File.html.
-			return hostLookupDNSFiles
+			// Workaround issues identified in https://github.com/golang/go/issues/35305
+			return hostLookupFilesDNS
 		}
 		return hostLookupFilesDNS
 	}
-- 
2.26.2

openSUSE Build Service is sponsored by