bin icon indicating copy to clipboard operation
bin copied to clipboard

gobin does not work at all on Windows

Open tssajo opened this issue 7 years ago • 26 comments

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!

tssajo avatar Nov 03 '17 13:11 tssajo

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

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

rjeczalik avatar Nov 03 '17 16:11 rjeczalik

@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!

tssajo avatar Nov 03 '17 16:11 tssajo

@tssajo Thanks, it's enough for me.

rjeczalik avatar Nov 03 '17 17:11 rjeczalik

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

tssajo avatar Mar 04 '18 00:03 tssajo

@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?

  • what does gobin C:\gocode\bin output?
  • add the following line after this line, build gobin again, run it and paste the output
fmt.Println(path, canwrite, fi.IsDir, fi.Mode().Regular(), IsExecutable(path), IsBinary(path))

rjeczalik avatar Mar 04 '18 00:03 rjeczalik

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 avatar Mar 04 '18 01:03 tssajo

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

tssajo avatar Mar 04 '18 01:03 tssajo

Typo - should be:

fmt.Println(path, canwrite, fi.IsDir, fi.Mode().IsRegular(), IsExecutable(path), IsBinary(path))

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

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...

tssajo avatar Mar 04 '18 01:03 tssajo

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

Try go install.

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

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

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

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?

tssajo avatar Mar 04 '18 01:03 tssajo

Any ideas?

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

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

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

tssajo avatar Mar 04 '18 01:03 tssajo

Here is the output:

image

tssajo avatar Mar 04 '18 01:03 tssajo

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

tssajo avatar Mar 04 '18 01:03 tssajo

It looks for every executable file in %PATH%.

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

OK

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

as you can see

tssajo avatar Mar 04 '18 01:03 tssajo

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

tssajo avatar Mar 04 '18 01:03 tssajo

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))

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

Sure. Results:

image

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

tssajo avatar Mar 04 '18 01:03 tssajo

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.

tssajo avatar Mar 04 '18 01:03 tssajo

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

  • add the line below here
fmt.Printf("which.NewExec(%q) failed: %#v\n", path, err)
  • and one here below
fmt.Printf("importpkg(%q) failed: %#v\n", p.path, err)

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

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"}

tssajo avatar Mar 04 '18 01:03 tssajo

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.

rjeczalik avatar Mar 04 '18 01:03 rjeczalik

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!

tssajo avatar Mar 04 '18 01:03 tssajo