Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: log: add flag to print file names relative to current directory #27847

Closed
krasi-georgiev opened this issue Sep 25, 2018 · 5 comments
Closed

Comments

@krasi-georgiev
Copy link

many terminals allow clickable paths to open the file in the default editor and all recognise relative paths.

I propose to add a flag to show a relative path : Lrelativefile in
https://golang.org/pkg/log/#pkg-constants

Using Llongfile renders the log lines too long and in most cases wraps the text in more than a single line.

@davecheney
Copy link
Contributor

Relative to what? The working directory of the process? The working directory of the editor? What if either change during the execution of the program?

@davecheney davecheney changed the title pkg/log: [ feature request ] add flag to show relative filename paths. proposa: pkg/log: add flag to show relative filename paths. Sep 25, 2018
@davecheney davecheney changed the title proposa: pkg/log: add flag to show relative filename paths. proposal: pkg/log: add flag to show relative filename paths. Sep 25, 2018
@gopherbot gopherbot added this to the Proposal milestone Sep 25, 2018
@krasi-georgiev
Copy link
Author

good point.
I just checked and vscode would make it clickable with : The working directory of the terminal.

What if either change during the execution of the program?

In reality when you run the binary in foreground you can't change the terminal directory anyway and when you run it in background this is even less relevant, no?

@rsc
Copy link
Contributor

rsc commented Oct 3, 2018

I understand the rationale but it seems a bit surprising and special purpose.
The go command does this, but the go command spends almost all its time printing these kinds of messages. It's not clear that every binary should do it.
In general I don't think most commands should change their output based on the directory where they are run.

/cc @robpike

@rsc rsc changed the title proposal: pkg/log: add flag to show relative filename paths. proposal: log: add flag to print file names relative to current directory Oct 3, 2018
@robpike
Copy link
Contributor

robpike commented Oct 7, 2018

I agree with @rsc and would prefer not to do this. It seems too likely to confuse.

@krasi-georgiev
Copy link
Author

krasi-georgiev commented Oct 7, 2018

got it .
thanks for spending the time to consider it!

@golang golang locked and limited conversation to collaborators Oct 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants