Skip to content

Name the write surface mode, user and group #512

Closed

Description

@David-Noble-at-work

The file provider's write methods take chmod os.FileMode and a Dockerfile-style chown string
("user[:group]"). Two problems:

  1. chmod is a verb. You do not pass a chmod; you pass a mode. The type is already os.FileMode and
    the accessor is FileInfo.Mode().
  2. The chown string makes the caller assemble a value the callee immediately takes apart with
    strings.Cut, and it has no counterpart in the surface these project into.

Ruled: mode, user, group. Starlark's audience reads Python, which is unambiguous —
os.chmod(path, mode), os.mkdir(path, mode=…), pathlib.Path.chmod(mode), and
shutil.chown(path, user=…, group=…). Go's own stdlib is not self-consistent here (perm when creating,
mode in os.Chmod), so there is no single convention to defer to; the projected surface decides.

Touches Copy, Mkdir, WriteBytes, WriteText and the internal write, plus applyChown/parseChown
which become applyOwnership/resolveOwnership taking the two sides directly.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions