]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/fsys: add Bind to add bind mounts
authorRuss Cox <rsc@golang.org>
Sun, 17 Nov 2024 00:40:42 +0000 (19:40 -0500)
committerGopher Robot <gobot@golang.org>
Tue, 19 Nov 2024 18:48:12 +0000 (18:48 +0000)
commit3a28cee8fb901a9ebd55ccf70f16b56cc14ebf5b
tree197c586fcdc246cce8f44d3411cc20ffc1c2d806
parentfa52db6a3ff9852dc25368d468d9eda2331e7a7d
cmd/go/internal/fsys: add Bind to add bind mounts

fsys.Bind(repl, dir) makes the virtual file system
redirect any references to dir to use repl instead.
In Plan 9 terms, it binds repl onto dir.
In Linux terms, it does a mount --bind of repl onto dir.
Or think of it as being like a symlink dir -> repl being
added to the virtual file system.

This is a separate layer from the overlay so that editors
working in the replacement directory can still apply
their own replacements within that tree, and also so
that editors working in the original dir do not have any
effect at all.

(If the binds and the overlay were in the same sorted list,
we'd have problems with keeping the relative priorities
of individual entries correct.)

Change-Id: Ibc88021cc95a3b8574efd5f37772ccb723aa8f7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/628702
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/fsys/fsys.go
src/cmd/go/internal/fsys/fsys_test.go