Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Remove dependency on HOME env var #103

Merged
merged 1 commit into from
Aug 31, 2020
Merged

Remove dependency on HOME env var #103

merged 1 commit into from
Aug 31, 2020

Conversation

cmoog
Copy link
Contributor

@cmoog cmoog commented Aug 31, 2020

Closes #102

@cmoog cmoog requested a review from wbobeirne August 31, 2020 19:33
@wbobeirne wbobeirne requested review from creack and removed request for wbobeirne August 31, 2020 20:33
@wbobeirne
Copy link

Tagging in @creack as both a Go wizard, and a Windows user

@cmoog
Copy link
Contributor Author

cmoog commented Aug 31, 2020

Tagging in @creack as both a Go wizard, and a Windows user

Sounds good. It should be noted that I am definitely not a windows user.

@creack
Copy link
Contributor

creack commented Aug 31, 2020

For the records, I am not either!, But I'll look into it :)

@@ -52,11 +52,14 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

usr, err := user.Current()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is going to be a problem on some systems and will prevent us from shipping a static binaries.
It has been a while, I'm looking into this to see the extent, it might have improved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I didn't see we were using it before already.
I checked and at least in go1.15, it does work without cgo! Which is quite neat.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with and without cgo, and tested on windows, works as expected.
Slight note on windows, the path output has double \.
window ssh-config coder-cli

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a fix that resolves the double \ (straight to master by accident 😰 ).

@@ -52,11 +52,14 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

usr, err := user.Current()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I didn't see we were using it before already.
I checked and at least in go1.15, it does work without cgo! Which is quite neat.

@@ -52,11 +52,14 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

usr, err := user.Current()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with and without cgo, and tested on windows, works as expected.
Slight note on windows, the path output has double \.
window ssh-config coder-cli

@cmoog cmoog merged commit 90dfe59 into master Aug 31, 2020
@cmoog cmoog deleted the fix-windows-home branch August 31, 2020 21:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows distro uses HOME env var which is commonly not available
3 participants