Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

how do I learn Go?

 
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I want to learn Go, is there some place I can go to learn it for free, or do I have to buy a book? And if the latter, what's the best book to learn it from?
 
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I started at golang.org and took the Tour. From there you'll find a number of links to more learning material. You can come back here if you have questions and we'll do our best to try and help.

Of course, you have to practice writing programs if you really want to learn.
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Junilu Lacar wrote:I started at golang.org and took the Tour. From there you'll find a number of links to more learning material. You can come back here if you have questions and we'll do our best to try and help.

Of course, you have to practice writing programs if you really want to learn.


I went to the website at "golang.org" and tried taking the Tour myself. When it mentioned the option to install Go on my own machine and then do the tour sans Internet, I thought that sounded like a good idea, so I downloaded it to my "C:\Go" directory. I went to my control panel and clicked <System->Advanced system settings->Environment Variables>, and created an environment variable named <GOPATH> whose value is "C:\Users\kvnsmnsn\Langs\Go". Then I created directory "C:\Users\kvnsmnsn\Langs\Go\src\github.com\user\hello", just as the Tour told me to, and put in that directory file "hello.go" with contents:

Then, also as the Tour told me to, I ran "go install github.com/user/hello". In response I got:

In fact, whenever I execute "go" and give it any command at all, I always get this same message. Anybody know what I'm doing wrong?
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kevin Simonson wrote:and created an environment variable named <GOPATH> whose value is "C:\Users\kvnsmnsn\Langs\Go".


You didn't by chance include the "<" and ">" in that name, did you? Because you shouldn't.
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, see if there's anything in these instructions that are different from what you did: http://www.wadewegner.com/2014/12/easy-go-programming-setup-for-windows/

I work on a Mac so I can only guess at what might be wrong in your setup. I'm guessing it's because you have "<GOPATH>" instead of just "GOPATH" though.
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Also, see if there's anything in these instructions that are different from what you did: http://www.wadewegner.com/2014/12/easy-go-programming-setup-for-windows/

I work on a Mac so I can only guess at what might be wrong in your setup. I'm guessing it's because you have "<GOPATH>" instead of just "GOPATH" though.


The only thing that website said to do that I didn't do was make sure I have "Mercurial download installed." I haven't installed Mercurial download. Furthermore, the word "download" was in blue so it looked to me like the way to
download Mercurial would be to click on it, so I clicked on it and a page came up that said:

So if the missing ingredient is having Mercurial download installed, then I need to know how to get Mercurial download installed.

As for my reference to <GOPATH>, I used the angle brackets to make GOPATH stand out from the rest of the text. Perhaps I shouldn't have. At any rate when I type in "echo %GOPATH%" I get:

So it looks like my GOPATH environment variable is correctly specified and pointing at the right place.

In case you want to know, my directory structure under "C:\Users\kvnsmnsn\Langs\Go" is:

I go to the "Go" directory and type in "go install github.com/user/hello" like the "https://golang.org/doc/install?download=go1.7.4.windows-amd64.msi#windows_env"; webpage told me to, and I get that same message:

Heck, I type in "go version", and I get that same message. This is really frustrating. Can someone please tell me what I'm doing wrong?
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, let's eliminate every possible problem. Is C:\Go\bin part of your system Path variable?
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Mercurial download is needed only if you're going to use a Mercurial repository.  I only have Git and I've been practicing with Go just fine.
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If all else fails, you could try uninstalling Go and reinstalling from the MSI.
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Junilu Lacar wrote:Ok, let's eliminate every possible problem. Is C:\Go\bin part of your system Path variable?


Take a look for yourself.

You can see it there on the last row, just after "Intel\WirelessCommon" and just before "Program Files\Intel\WiFi\bin".

I noticed that just a little bit later you mentioned the possibility of uninstalling Go and reinstalling it again. Do you think that that might fix the problem? I downloaded it originally from the "golang.org" website. Is there another place I can download it from that might have a better chance of succeeding?
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you should just use the MSI you downloaded from the Go download page. You might want to double check the SHA256 checksum to make sure you got a good download.
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Junilu Lacar wrote:No, you should just use the MSI you downloaded from the Go download page. You might want to double check the SHA256 checksum to make sure you got a good download.


Okay, I removed Go, and I'm ready to run the MSI again, and I've got the 66-byte checksum. How do I check the MSI against the checksum? I've never done that before.
 
Sheriff
Posts: 21817
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use HashMyFiles for that. Open a file in it, then copy the checksum to your clipboard. If it matches, HashMyFiles will show the matching entry in green. You may need to enable the "Mark Hash in Clipboard' and "Mark Identical Hashes" options in the Options menu first.
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:I use HashMyFiles for that. Open a file in it, then copy the checksum to your clipboard. If it matches, HashMyFiles will show the matching entry in green. You may need to enable the "Mark Hash in Clipboard' and "Mark Identical Hashes" options in the Options menu first.


Thanks, Rob, I used HashMyFiles and verified that the checksum for my copy of "go1.7.4.windows-amd64.msi" matches what was published on the "golang.org" website. I removed Go, and reinstalled it again. I typed in "echo %GOPATH%" and got:

I typed "echo %PATH%" and verified that "C:\Go\bin" is in there. But when I type in "go version", I still get:

In fact, I tried just going down the list, typing in "go build", "go clean", "go doc", "go env", etc., and no matter what I type in I keep getting that general informational message. I'm getting really tired of reading that general informational message! What am I doing wrong?
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just had a thought. My GOPATH environment variable is pointing to my local "Go" directory, the root directory for all the Go code I'm going to write, that has contents:

Is that the place GOPATH is supposed to point to? Should it be pointing to "C:\Go" instead?
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your GOPATH should point to where it's pointed to now, so no, you shouldn't change it.
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't find any reference to this kind of problem with a Go install. I wish I had asked you this before, but did you confirm that after you uninstalled Go, that typing "go version" gave you an invalid command error? Just grabbing at straws at this point but it won't hurt to eliminate the possibility that there's a stray Go install somewhere on your path, however remote or seemingly impossible that may seem.
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Junilu Lacar wrote:I can't find any reference to this kind of problem with a Go install. I wish I had asked you this before, but did you confirm that after you uninstalled Go, that typing "go version" gave you an invalid command error? Just grabbing at straws at this point but it won't hurt to eliminate the possibility that there's a stray Go install somewhere on your path, however remote or seemingly impossible that may seem.


I used my copy of "go1.7.4.windows.amd64.msi" to remove Go, and then I typed in:

and got that response. So it looks like I don't have "a stray Go install someone on" my path.
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a strange error message though. That's not what you get when you try to type in some nonsense command like "qwerty" or "foobar", right?

Shouldn't you be getting something like:

C:\>go
'go' is not recognized as an internal or external command, operable or batch file


instead?
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that error message might lead you to what's been preventing you from running Go.  

See https://coderanch.com/t/646513/java/system-find-path or search for other ways to resolve system cannot find the path specified error
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want immediate Go gratification, you could try moving C:\Go\bin to the front of your PATH.
 
Marshal
Posts: 7255
492
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kevin Simonson wrote:In fact, whenever I execute "go" and give it any command at all, I always get this same message.

Can you make a screenshot of you command prompt after you type in command to execute, but before hit enter. And upload screenshot here. From the given response sounds looks like instalation is ok as you get suggestion about its use. Seems like doesn't like the instruction you write.

Please ignore, it seems you already copied it from command prompt with its full use.
 
Kevin Simonson
Ranch Hand
Posts: 224
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Junilu Lacar wrote:I think that error message might lead you to what's been preventing you from running Go.  

See https://coderanch.com/t/646513/java/system-find-path or search for other ways to resolve system cannot find the path specified error


I feel like an idiot! In my file that sets all my aliases I had a line that said:

which means that every time I executed "go" regardless of the arguments I passed it, that had the effect of calling "C:\Go\bin\go" without passing any arguments! If I'd had:

instead, it would have worked just fine. But since the installer puts "C:\Go\bin" in my PATH variable anyway, I just removed that line from my file and now I can execute "go version" and get:

Problem solved.
 
Liutauras Vilda
Marshal
Posts: 7255
492
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a cow for finding and posting an issue. It might will be helpful for somebody else in the future
 
Junilu Lacar
Marshal
Posts: 14262
236
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kevin Simonson wrote:I feel like an idiot! ... Problem solved.


No worries. Now we can finally stop mucking about with your configuration and get Go-ing!!!  

I've been looking for somebody to bounce around Go questions with.
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!