Skip to content

cmd/go: add -C flag to change directory #50332

Closed
@thockin

Description

@thockin

I'm not sure if this rises to a proposal or not.

Many tools (e.g. make, git) have a universal -C <dir> flag which lets you do things in other directories without pushd/popd silliness. Given how go uses CWD for important things like modules, it would be nice to have something like this in go. For example go -C path/to/dir list gives me the package-path. Otherwise it's things like pushd path/to/dir >/dev/null; go list; popd >/dev/null.

It's really just a convenience thing. Has it already been discussed? I couldn't find it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions