diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-28 00:15:52 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-28 00:16:44 +0700 |
| commit | 5aafb2bf78ba7e421d75cdef028850a6dc8c286f (patch) | |
| tree | f245567c89165a8dc44431eb4e8c7c4088bbe434 /cmd | |
| parent | 701ad0f9188f0cba9e220c97aa78546a0da98344 (diff) | |
| download | compute-archlinux-image-builder-5aafb2bf78ba7e421d75cdef028850a6dc8c286f.tar.xz | |
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).
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/golookup/main.go | 21 |
1 files changed, 21 insertions, 0 deletions
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 <ms@kilabit.info> + +// 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) +} |
