Comment by emersion
2 months ago
The following would probably be more portable:
///usr/bin/env go run "$0" "$@"; exit
Note, the exit code isn't passed through due to: https://github.com/golang/go/issues/13440
2 months ago
The following would probably be more portable:
///usr/bin/env go run "$0" "$@"; exit
Note, the exit code isn't passed through due to: https://github.com/golang/go/issues/13440
Does the third leading slash do something?
No, it just felt a tad cleaner to have the comment slashes separate from the path leading slash.
To quote the blog in question:
> How true this is, is a topic I dare not enter.
The blog says that in regard to finding bash with env. My reading is that it does not make the same claim regarding finding go with env. bash is commonly found at /bin/bash (or a symlink there exists) as it is widely used in scripts and being available at that path is a well known requirement for compatibility. Go does not so much have a conical path and I have personally installed it at a variety of paths over the years (with the majority working with env). While I agree with the author of the blog that using env to find bash may or may not improve compatibility, I also agree with the parent comment that using env to find go probably does improve compatibility.