From 5aafb2bf78ba7e421d75cdef028850a6dc8c286f Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 28 Jan 2026 00:15:52 +0700 Subject: all: set the resolv.conf symlinked to systemd stub-resolv.conf The default resolv.conf is empty. This cause program that depends on resolv.conf for name resolution will fail. As a test, we create small Go program "cmd/golookup" that can lookup IP address of host name using pure Go resolver (using/etc/resolv.conf). --- cmd/golookup/main.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cmd/golookup/main.go (limited to 'cmd/golookup') diff --git a/cmd/golookup/main.go b/cmd/golookup/main.go new file mode 100644 index 0000000..5649705 --- /dev/null +++ b/cmd/golookup/main.go @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: Apache-2.0 +// SPDX-FileCopyrightText: 2026 M. Shulhan + +// golookup program to test lookup for IP addresses using pure Go resolver +// (using name server from /etc/resolv.conf, instead of nss APIs). +package main + +import ( + "fmt" + "log" + "net" + "os" +) + +func main() { + addr, err := net.LookupHost(os.Args[1]) + if err != nil { + log.Fatal(err) + } + fmt.Println(addr) +} -- cgit v1.3