rjeczalik / bin

Looks for Golang executables in $PATH, guesses their origin and updates them or creates $GOPATH workspaces.
MIT License
45 stars 1 forks source link

gobin does not work at all on Windows #9

Open tssajo opened 6 years ago

tssajo commented 6 years ago

This is a very useful program! It works perfectly on Linux. But it does not work at all on Windows 7 x64 :(

Can you please fix it?

Please let me know if you need any specific info from me or if you want me to test something for you on Windows. Thanks!

rjeczalik commented 6 years ago

But it does not work at all on Windows 7 x64 :(

Do you have any error messages, screencasts etc. which demonstrate the problem?

tssajo commented 6 years ago

@rjeczalik No screencast and no error messages. Here is what's happening. I go to the CMD prompt and then: CD %GOPATH%\bin I got into the directory where gobin.exe is installed. On my PC it is: C:\gocode\bin then I run the program: gobin and it immediately returns with no output at all. But there are a bunch of binaries in my bin directory. Please see this screenshot:

image

Here is the output of go env :

image

Please let me know what do you want me to test. Thanks!

rjeczalik commented 6 years ago

@tssajo Thanks, it's enough for me.

tssajo commented 6 years ago

Hello, Did you manage to fix this bug? Please let me know! Thanks!

rjeczalik commented 6 years ago

@tssajo No, sorry - I was overwhelmed with other activities and in the meantime I lost access to my only windows box. Maybe you could troubleshoot this for me?

fmt.Println(path, canwrite, fi.IsDir, fi.Mode().Regular(), IsExecutable(path), IsBinary(path))
tssajo commented 6 years ago

Yes, I'll troubleshoot! That's what I wanted to offer, actually.

I add that line now and I get back to you in a few minutes.

tssajo commented 6 years ago

hm. the quick result is: image But I fix this, do not worry. I get back to you in a moment

rjeczalik commented 6 years ago

Typo - should be:

fmt.Println(path, canwrite, fi.IsDir, fi.Mode().IsRegular(), IsExecutable(path), IsBinary(path))
tssajo commented 6 years ago

Yes, I just fixed that line to this: fmt.Println(path, canwrite, fi.IsDir, fi.Mode().IsRegular(), IsExecutable(path), IsBinary(path))

It compiles now.

However, the Go 1.10 build command does not place the gobin program into my bin directory... I do not know why. I investigate...

rjeczalik commented 6 years ago

However, the Go 1.10 build command does not place the gobin program into my bin directory

Try go install.

rjeczalik commented 6 years ago

Oh, please ensure you install .\cmd\gobin - this is where main lives.

tssajo commented 6 years ago

Well, I tried that already but nothing! :(

See:

image

So go build runs with no errors, same for go install but the binary file is nowhere to be found... :(

I've never seen this before. But maybe I am doing something wrong...

Or the freshly installed Go 1.10 just doesn't work for some reason. (I installed it less than an hour ago.)

Any ideas?

rjeczalik commented 6 years ago

Any ideas?

See my second comment, run go install in ...\rjeczalik\bin\cmd\gobin.

tssajo commented 6 years ago

OK, It got installed when I ran go install from that sub-directory

tssajo commented 6 years ago

Here is the output:

image

tssajo commented 6 years ago

I have no idea why it is looking at my nodejs ( installed via npm ) binaries....

rjeczalik commented 6 years ago

It looks for every executable file in %PATH%.

tssajo commented 6 years ago

OK

Anyhow, for all go binary files the results are: true 0x60f4a0 true true true

as you can see

tssajo commented 6 years ago

one thing I can think of: in Windows the directory separator is "\" while on *nix it is "/" could this difference cause this problem? see: https://golang.org/pkg/os/#PathSeparator

rjeczalik commented 6 years ago

Oh sorry, another typo - it's a middle of a night for me. Could you try this line instead:

fmt.Println(path, canwrite, fi.IsDir(), fi.Mode().IsRegular(), IsExecutable(path), IsBinary(path))
tssajo commented 6 years ago

Sure. Results:

image

Middle of night here, too. I'm in Hungary.

tssajo commented 6 years ago

I ran it with your suggested CLI arg, see:

image

Now it only checks that directory for binaries. But the output for those files are the same as above.

rjeczalik commented 6 years ago

Ok, so file modes are ok, most likely the thing that fails is reading import path from a binary. Could you:

fmt.Printf("which.NewExec(%q) failed: %#v\n", path, err)
fmt.Printf("importpkg(%q) failed: %#v\n", p.path, err)
tssajo commented 6 years ago

Sure. Results are:

C:\Users\User\AppData\Roaming\npm\cleancss true false true false false
C:\Users\User\AppData\Roaming\npm\cleancss.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\css-beautify true false true false false
C:\Users\User\AppData\Roaming\npm\css-beautify.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\csslint true false true false false
C:\Users\User\AppData\Roaming\npm\csslint.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\etc true true false false false
C:\Users\User\AppData\Roaming\npm\gulp true false true false false
C:\Users\User\AppData\Roaming\npm\gulp.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\html-beautify true false true false false
C:\Users\User\AppData\Roaming\npm\html-beautify.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\html-minifier true false true false false
C:\Users\User\AppData\Roaming\npm\html-minifier.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\html2jade true false true false false
C:\Users\User\AppData\Roaming\npm\html2jade.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\js-beautify true false true false false
C:\Users\User\AppData\Roaming\npm\js-beautify.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\jshint true false true false false
C:\Users\User\AppData\Roaming\npm\jshint.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\jsxhint true false true false false
C:\Users\User\AppData\Roaming\npm\jsxhint.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\minjson true false true false false
C:\Users\User\AppData\Roaming\npm\minjson.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\node-gyp true false true false false
C:\Users\User\AppData\Roaming\npm\node-gyp.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\nodemon true false true false false
C:\Users\User\AppData\Roaming\npm\nodemon.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\node_modules true true false false false
C:\Users\User\AppData\Roaming\npm\pakmanager true false true false false
C:\Users\User\AppData\Roaming\npm\pakmanager.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\svgo true false true false false
C:\Users\User\AppData\Roaming\npm\svgo.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\uglifycss true false true false false
C:\Users\User\AppData\Roaming\npm\uglifycss.cmd true false true false false
C:\Users\User\AppData\Roaming\npm\uglifyjs true false true false false
C:\Users\User\AppData\Roaming\npm\uglifyjs.cmd true false true false false
C:\gocode\bin\benchcmp.exe true false true true true
C:\gocode\bin\bundle.exe true false true true true
C:\gocode\bin\callgraph.exe true false true true true
C:\gocode\bin\compilebench.exe true false true true true
C:\gocode\bin\cover.exe true false true true true
C:\gocode\bin\digraph.exe true false true true true
C:\gocode\bin\eg.exe true false true true true
C:\gocode\bin\fiximports.exe true false true true true
C:\gocode\bin\getgo.exe true false true true true
C:\gocode\bin\go-contrib-init.exe true false true true true
C:\gocode\bin\gobin.exe true false true true true
C:\gocode\bin\gocode.exe true false true true true
C:\gocode\bin\godef.exe true false true true true
which.NewExec("C:\\gocode\\bin\\benchcmp.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\benchcmp.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\godex.exe true false true true true
C:\gocode\bin\godoc.exe true false true true true
C:\gocode\bin\goimports.exe true false true true true
C:\gocode\bin\golint.exe true false true true true
C:\gocode\bin\gomvpkg.exe true false true true true
which.NewExec("C:\\gocode\\bin\\compilebench.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\compilebench.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\bundle.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\bundle.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\digraph.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\digraph.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\gorename.exe true false true true true
which.NewExec("C:\\gocode\\bin\\fiximports.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\fiximports.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\gotype.exe true false true true true
which.NewExec("C:\\gocode\\bin\\callgraph.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\callgraph.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\gobin.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\gobin.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\go-contrib-init.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\go-contrib-init.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\goyacc.exe true false true true true
which.NewExec("C:\\gocode\\bin\\eg.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\eg.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\guru.exe true false true true true
which.NewExec("C:\\gocode\\bin\\cover.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\cover.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\gocode.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\gocode.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\heapview.exe true false true true true
which.NewExec("C:\\gocode\\bin\\godex.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\godex.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\golint.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\golint.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\getgo.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\getgo.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\html2article.exe true false true true true
which.NewExec("C:\\gocode\\bin\\goimports.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\goimports.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\gorename.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\gorename.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\present.exe true false true true true
which.NewExec("C:\\gocode\\bin\\godef.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\godef.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\ssadump.exe true false true true true
which.NewExec("C:\\gocode\\bin\\gomvpkg.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\gomvpkg.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\html2article.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\html2article.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\goyacc.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\goyacc.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\stress.exe true false true true true
C:\gocode\bin\stringer.exe true false true true true
which.NewExec("C:\\gocode\\bin\\godoc.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\godoc.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\tip.exe true false true true true
which.NewExec("C:\\gocode\\bin\\heapview.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\heapview.exe") failed: &errors.errorString{s:"which: not a Go executable"}
C:\gocode\bin\toolstash.exe true false true true true
C:\gocode\bin\_err.txt true false true false false
which.NewExec("C:\\gocode\\bin\\gotype.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\gotype.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\guru.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\guru.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\stress.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\stress.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\present.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\present.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\toolstash.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\toolstash.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\ssadump.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\ssadump.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\stringer.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\stringer.exe") failed: &errors.errorString{s:"which: not a Go executable"}
which.NewExec("C:\\gocode\\bin\\tip.exe") failed: &errors.errorString{s:"which: not a Go executable"}
importpkg("C:\\gocode\\bin\\tip.exe") failed: &errors.errorString{s:"which: not a Go executable"}
rjeczalik commented 6 years ago

That is what I was afraid of, something here fails, and that would not be easy to debug remotely.

You could give it a shot, if you want, just log all the errors there and see what we may get. My hunch is something in debug/pe package changed which is not backward-compatible, and this is why it fails.

tssajo commented 6 years ago

OK, I will check it out. But only tomorrow, not tonight.

I'll report you back what I've found.

If I manage to fix it, I'll submit a PR.

Thanks for trying to help tonight!