Skip to content

proposal: os: add PathSeparatorString and PathListSeparatorString #30614

@ianlancetaylor

Description

@ianlancetaylor

Issue #3939 proposes eliminating the conversion from integer types to string types. Examining code shows that one common case where the conversion is used correctly is string(os.PathSeparator). If we eliminate the conversion from the language, we will need a replacement for code of that sort, ideally one that does not involve a function call.

I propose that we add two new constants to the os package: PathSeparatorString and PathListSeparatorString. These are the best names I've come up with, but they are not great, and I would be happy to hear better suggestions. The new constants will have the same value as the current constants PathSeparator and PathListSeparator, but will be untyped string constants rather than untyped rune constants.

Similarly, I propose that we add SeparatorString and ListSeparatorString to the path/filepath package.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions