Categories
Resources Software Development

Linux how to fix Command ‘go’ not found, but can be installed with:

Command ‘go’ not found, but can be installed with:

So you just installed Go on Linux huh?

go not found
go not found error

This means you probably set the environmental variable via the command line which is temporary.  Don’t install go this way. You could do as the documentation says and add :

export PATH=$PATH:/usr/local/go/bin

However if you look in that file it has some important looking code in it. This is because it is a script.

linux profile script
linux profile script

It felt dirty to place the above code in that file so I did some research and found a better alternative. You simply create a new file in the /etc/profile.d directory and place the above export line of code in it and save it. You can name the file anything and add .sh to it and it will be found and loaded. Then you logout and back in like the documentation suggests and open a terminal and type “go version” and it works properly.

See my go_profile.sh file :

profile.d directory
linux profile.d directory

Doing it this way instead of adding it to the ~.profile file is better because it reduces the chance of messing up the code in a file. The script actually reads all of the files in the profile.d folder and this is why it works. For more information see this article in the section “Persistent environment variables”. You can do any other environmental variables you need set this way too.

Categories
Resources Software Development Web Development

Golang useful resources.

Useful Golang programming resources

Making The Move From Scala To Go, And Why We’re Not Going Back -> a great article about some reasons why a company switched to golang. It mentions some important things to consider. Golang is great for microservices.

Golang book. Free online book.

50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs

Golang Modules explained

More about Golang Modules

Golang Slices explained

Golang pointers explained in the tour

Golang interfaces explained. This is a very helpful article. I found the interfaces section on tour of go to be nonsensical jibberish. Here is the pure jibberish

var a Abser
f := MyFloat(-math.Sqrt2)
v := Vertex{3, 4}

a = f // a MyFloat implements Abser
a = &v // a *Vertex implements Abser

How is this implementing anything? It looks to me like assignment? Makes ZERO sense. Most of the tour is awesome and makes sense but this entire section is pure fail. It causes more questions than answers. Like this
// In the following line, v is a Vertex (not *Vertex)
// and does NOT implement Abser.
a = v

Ok  I am new. This to me looks like reassignment. Once again how does assignment make something implement something? And why not explain it to the new users? Any details as to what is going on would be helpful to new comers. If you quote it out and run the program it works. This section needs heavy updating and explaining. This is purely WTFF??? This is literally the absolute worst part of the entire Tour. This is where I hit my WTF moments and had to start using google to DECIPHER the encoded message.

Thinking in Go. This article is a must read for anyone coming from an OOP background such as Java wanting to understand Golang. There are no classes. No inheritance. No generics. No this. No that and No. Golang requires thinking entirely differently. Interfaces are the hardest thing to wrap my mind around so far.  The implicit magic is something  I don’t like I prefer words like implements to make my code more clear. If I could just find good enough information I’d understand it. I literally have to undo all of the years of OOP damage. When I first encountered Golang I heard that interfaces confused most new people, I understand why now. It is not just interfaces it is learning to think and build software in an entirely new alien way.

Golang Structs explained

More on Golang Interfaces — because they are nothing like interfaces you have face in other languages. The whole implementing thing is just totally wild. I hate implicit bullshit. It’s just unneeded magic for no reason other than to drop a few characters.https://www.digitalocean.com/community/tutorials/how-to-deploy-a-go-web-application-using-nginx-on-ubuntu-18-04

Thinking about Interfaces in Go — another great article about Golang interfaces. Interfaces are the most complex thing in go, so multiple references helps  more.

Go for Java Programmers — this is an awesome series of articles for java programmers coming to Golang. This is also helpful to PHP programmers since PHP is so similar to Java these days.

Go in VSCode: Must-have extensions and some limitations

Building Web Applications with GO — a free online book about how to build a web app with golang

How to deploy a Golang Application on Linux with NGINX 

 Go: the Good, the Bad and the Ugly   An article with lots of good information about Gotchas in Golang and some best practices.
Golang: Concurrency is Hard; So What Can We Do About It? A very good article about concurrency in Golang

Everything you need to know about Packages in Go – a great article all about packages.

Publishing Golang packages – golang article about how to version packages/modules

Why you should use a Go module proxy– why and how to create a go module proxy

Go 1.13 for Private Repositories  – What are private repositories

Videos

GothamGo 2018 – Things in Go I Never Use by Mat Ryer

7 common mistakes in Go and when to avoid them by Steve Francia (Docker)