]> Cypherpunks.ru repositories - gostls13.git/commit
os: depend on Readlink only when necessary
authorEgon Elbre <egonelbre@gmail.com>
Tue, 20 Apr 2021 14:38:54 +0000 (17:38 +0300)
committerTobias Klauser <tobias.klauser@gmail.com>
Thu, 22 Apr 2021 21:03:32 +0000 (21:03 +0000)
commitcfe5d79c5c2c9888a0e56e089dca99e405a225b9
tree98ecca28b1161a03395b5f737bf3e0230fab7a00
parentecfce58965da6017e02f5fc5c03eda52fc41c8d6
os: depend on Readlink only when necessary

Currently Readlink gets linked into the binary even when Executable is
not needed.

This reduces a simple "os.Stdout.Write([]byte("hello"))" by ~10KiB.

Previously the executable path was read during init time, because
deleting the executable would make "Readlink" return "(deleted)" suffix.
There's probably a slight chance that the init time reading would return
it anyways.

Updates #6853

Change-Id: Ic76190c5b64d9320ceb489cd6a553108614653d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/311790
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
src/os/executable_procfs.go
src/os/executable_test.go