For example in Go:
$ cd /path/to/go/repo
$ go run cmd/myapp
package cmd/myapp is not in std (/usr/local/go/src/cmd/myapp)
$ go run ./cmd/myapp
Hello, World!
And then people don't want to think about when your path is for the shell and when it's a CLI param and how the CLI treats it, and just use the version that always works.Similarly, package installers can use this to disambiguate between "install the local file with this exact name" and "look up a file on the index for the named package".
In `go run` the CLI interprets it as universal path, to be precise. That's exactly the point.
> go run github.com/user/name/cmd/myapp
That's not an alternative when you're working on the app's code locally. You have to use `./cmd/myapp`.
And when you do that multiple times per day/week, after a while you just start always using `./` prefix for local paths.
For example
- go run go://cmd/foo
- go run file:///cmd/foo
So I think you and I differ on this one, but none of this is a hill I care to die on.
Usually it's tab-complete adding the slash though, I don't go typing it in.
I also alias 'ls' to 'ls -F' so that directories have a / appended, makes it easier to understand the output.
As an argument in a line? My shell offers completion from the current directory without ./ just fine.
You only need to prepend dotslash to a filename in order of disambiguate invocations of executables in the the current directory (and not a subdirectory).
This is because bare commands will be looked up in $PATH, rather than among executable files in $PWD.
It strikes me as weird copycat (without understanding) programming to just have it wherever you're referring to a local file. In fact I prefer to invoke `bash foo.sh` rather than `mv foo.sh foo; chmod +x foo.sh; ./foo.sh`. (This assumes that I don't need to rely on something special in the shebang line.) This also lets you use tab-completion as normal, as well as adding flags for bash like -x.
(I know you could use it for clarity when an argument could look like a string or a file, but I don't think that's usuaully the purpose.)