scripts/with-go-mod.sh: simplify symlink comparison

Make sure the symlinks point to the same file; not if both are
identical (absolute or relative symlink); it's only for suppressing
the warning so not critical.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-06-10 15:44:04 +02:00
parent c17c247ed4
commit deacdc6feb
+3 -5
View File
@@ -17,14 +17,12 @@ create_symlink() {
local target="$1"
local link="$2"
if [ -L "$link" ] && [ "$(readlink "$link")" = "$target" ]; then
# symlink already present; we're done
return
fi
if [ -e "$link" ]; then
# see https://superuser.com/a/196698
if ! [ "$link" -ef "${ROOTDIR}/${target}" ]; then
echo "$(basename "$0"): WARN: $link exists but is not the expected symlink!" >&2
echo "$(basename "$0"): WARN: Using your version instead of our generated version -- this may misbehave!" >&2
fi
return
fi