I want to learn it

I want to learn it.

Other urls found in this thread:

golang.org/doc/install
github.com/astaxie/beego).
pastebin.com/raw/S9ebLQ8a
github.com/nsf/gocode
tour.golang.org
dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully
dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package
github.com/avelino/awesome-go
golang-book.com/books/intro
code.visualstudio.com/
github.com/Microsoft/vscode-go
yager.io/programming/go.html
oracle.com/technetwork/articles/java/ma14-java-se-8-streams-2177646.html
twitter.com/NSFWRedditGif

golang.org/doc/install

Make sure your go path is set up. Also a tip: be on Linux. While go works on Windows, it's unforgiving as it's a non graphical language.

Also I recommend Atom as an IDE, with the plugin go-plus. It's what I use at work.

Cont.

Most people have issues with the actual environment starting out...

A gopath is basically a folder with three sub directories (bin, src, pkg) that is under the environmental variable GOPATH. So, on Linux my gopath might be /home/user/go

As for actual projects, your working directory is in $GOPATH/src. In this directory, you can run commands like go run, go build, and go install. For projects though, I recommend each one being in its own folder under src.

Cont.

Dependencies

Make sure you have git installed.
Dependencies are easy to install on go. Most of the time you'll depend on something that's on Github. For this example, let's use this chink web framework, beego (github.com/astaxie/beego). To get it, all we need to do is type is 'go get github.com/astaxie/beego'. This will download it to our $GOPATH/src. This allows us to reference it, and even modify it.

>want to learn Go
for what purpose

I use vim for go development. Make sure you install the "vim-go" plugin.

Also like the other guy said don't use Windows. Linux is far better not just for writing go, but for pretty much everything.

concurrent network software

erlang is cooler

It seems like a good language to learn.

if pajeet can do it, I'm sure you can too, OP.

can you share your plugins?

for learning is it okay to use a 1gb and atom processor netbook?

yes

yes, cool thing about Go is it compiles super fast.

thanks,

currently i'm developing android apps and I want to learn go for REST stuff

Is there an available autocompletion elisp for go-lang?, like company-python for python language and company-irony for c and c++.

bump.

and that you can include C scripts

Read the documentation on the Go website and be amazed how poorly the language is designed.

>Atom
Kek'd.

>poorly
that's a funny well to say "well"

Name one unique selling point about Go.

call vundle#begin()
"basic
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs' "left tab list
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tpope/vim-fugitive'
Plugin 'Valloric/YouCompleteMe' "must be compiled
Plugin 'scrooloose/syntastic' "syntax checker
Plugin 'SirVer/ultisnips'
Plugin 'ervandew/supertab'
Plugin 'jiangmiao/auto-pairs'
Plugin 'vim-scripts/AutoComplPop'
Plugin 'honza/vim-snippets'

"go-lang
Plugin 'fatih/vim-go'
"html
Plugin 'alvan/vim-closetag'
Plugin 'othree/html5.vim'
Plugin 'mattn/emmet-vim'
"CSS
Plugin 'ap/vim-css-color'
Plugin 'hail2u/vim-css3-syntax'
"javascript
Plugin 'ternjs/tern_for_vim'
call vundle#end()

pastebin.com/raw/S9ebLQ8a

It's so simple it only takes a couple days to learn the whole language (if you have programming experience) and it's very good at high concurrency network programming.

And people are hiring, unlike erlang.

Pic related, golang only has 25 keywords, less than the number of letters in the alphabet.

It's simple and very fast.

$GOPATH=$HOME
nigga please

-Very simple language, easy to learn, easy to reason about
-Uses modules as classes, makes things easy to refactor because modules are not types
-module system works on your entire computer, you dont need to set up library configuration in your IDE, your entire Go directory in your GOPATH sees all the go programs you have and can use modules from any of them
-Has type inference, closures
-Very safe language but still very fast, negligbile speed difference between C/C++

Go is indeed a simple language to learn. It took me a day to write my first basic application. It took me a month to figure out that Go is absolute shit. I figured that one out because my code was 50℅ nil checks on errors.
Go is so simple because Pike is autistic as fuck. That guy still lives in the 80's. He rejects all modern day programming concepts because they're too complex. The biggest missing feature are generics.
If you're still not convinced, go have a look at the current state of the Go compiler. It's a remnant of a Plan 9 compiler automatically converted to Go. They just finished implementing SSA instructions for x86. ARM is still missing.

>The biggest missing feature are generics.
Another butthurt C++ programmer, there is nothing modern about a programming language that uses pre-compilation macros as a core part of its syntax. Anyone who still programs like that is a dinosaur, enjoy the rest of your life wasted on becoming an 'expert' by fixing an inherently gimped language. C++ will never be modern, it will always be tied to C backward compatibility, adding any actual modern features without templates would break the language

>the language has good error checking so that makes it bad

You know you're retarded right? It's much better than Javas try-catch and if you're working in enterprise you need robust error checking. Go forces this and it's a good thing.

Go is a better language than C++, Java, PHP, or JavaScript.

D, Go, and Rust are pretty much on par

C is maybe better in some ways but it's unsafe.

I bet you're a C++ code monkey or just some retard who thinks C++ is good because "hurp derp muh gayms are written in it"

kys

OP this guy is a retard who probably uses C++.

A lot of idiots choose this language because they want to be gaym programmers.

Gaym programming is only idolized by retards who gaym so much they can't even get laid and they stay a virgin their whole life.

learn go --> loose your virginity

learn c++ --> never loose your virginity.

The choice is yours OP.

He makes a valid point on the nil checks on errors though

ultimately, simply built-in concurrency. that's what it does that no other equally established language does as well.

outside of the language spec itself, the tooling is novel and as convenient as ultra-developed commercial shit worth thousands of dollars, with a fraction of the complexity.

the documentation is complete and concise. it can be difficult to sift through at first coming from other languages.

the rest is incidental, found elsewhere or debatable depending on how much you personally agree with Pike.

No, he doesn't, because in the enterprise robust error handling is important.

would you rather write 50% exception/try/catch blocks in your code?

Thanks friendo

Fun fact: I'm not a C++ programming. Though, I've used it for a couple of months when I toyed around with Qt. They fucked up big time. It's a huge clusterfuck. C++11 made it even worse. The only thing good about C++ is the fact that it's blazing fast at runtime. Other than that, they should've just made it 'C with classes'.
My day job is writing Java. And I agree, exceptions are a huge burden in all aspects. explicit error checking is just as bad as C style error codes. I seriously hope you agree with me on that.
Green threads are a great concept and are implemented well in Go. That's why Twitch built their live chat in Go. The only thing I consider a huge miss is having channels scale across multiple machines. AFAIK Erlang does have that feature.
The way Rust handles error checking by wrapping them in a Result or Option is the way to go in my opinion. You can use the try! macro to reduce code bloat. Haskell might do it better, but I've never used that myself.

>there an available autocompletion elisp for go-lang?, like co

yep i have company-go backend which uses go-code
> github.com/nsf/gocode

>The only thing I consider a huge miss is having channels scale across multiple machines.

I think that's out of scope for the language spec itself. very, very complex thing to implement and perfectly doable via (possibly standard) libs.

I'm not sure what the benefits of spreading large workloads across multiple machines instead of finding ingenious ways to separate them.

Rust is a mess. Learn go.

>The only thing good about C++ is the fact that it's blazing fast at runtime.
I hate to bash C++, it makes for a good benchmark language to give a sanity check when designing languages that use different types of garbage collection. But the fact that its so barebones does not mean its 'blazingly fast', thats a myth. In actuality languages like Java can beat C++ in certain types of algorithms because of the runtime optimizations that the VM can make, which is why the LLVM compiler is designed with a virtual machine.

tour.golang.org

m8, IMO, you should always tell people to start from ^^. the tour is quite the fun, and a very easy way to learn

vscode (yeah, I know...) supports Go, too

wtf? it's one of the best documented code I've read...
>Name one unique selling point about Go.
the stability, simplicity and the concurrency features, of course.

neat. thx.

Why would anyone learn this? Seriously, what's its purpose?

dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully
dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package

ask the people/companies behind these projects:
github.com/avelino/awesome-go

Literally a non-answer.
I want to know why should I use this over say python or C or Java

I'm no expert when it comes to high performance networking, but I know there's a demand for applications that use a producer-consumer model that scales across multiple machines. Kinda like a load balancer. WhatsApp might have written a few articles about it.
Go is a mess. Learn Pascal.
You're right. There's no best. Some tasks are better off using a VM instead of running bare metal. Java can be faster than C++ when the task involves a lot of memory allocation. Hard real-time applications cannot be run inside a VM.
I find the Go documentation lacking. Especially compared to the Java documentation.
(Un)marshalling has a lot of weird undocumented edge cases. See the issue tracker for more details. Also check out some blog posts that mention it.
The HTTP router in the net/http router also has lots of quirks that are not mentioned in the documentation.
I also find the godoc tool a bit lacking in terms of features.

read the thread? at least 4 posts ITT give some pros/cons of Go.

java as an example of good documentation? it's a fucking mess IMO. it sucks.
>(Un)marshalling has a lot of weird undocumented edge cases
>The HTTP router in the net/http router also has lots of quirks that are not mentioned in the documentation.
>I also find the godoc tool a bit lacking in terms of features.
well, I guess
1. you could read the sources
2. patches are welcome, probably

golang-book.com/books/intro

code.visualstudio.com/

github.com/Microsoft/vscode-go

You're all set now.

>The HTTP router in the net/http router also has lots of quirks that are not mentioned in the documentation.
You shouldn't use it anyway.

It takes two days to learn, people are hiring go devs, and it's fast as shit when using it for things that involve concurrency.

C is unsafe. I would only use it for things like a jet aircraft or a large machine that doesn't process much network traffic.

Python is slow as shit.

Java runs in a fucking VM

C++ is a huge mess of a language

D is better than C++

Rust is as much of a mess as C++, but it's a more organized and planned mess

If you want make fast programs and not have to deal with a messy language use Go.

go supports rpc

>conclusion: use opaque errors
And now you have an error without knowing the context. Is it I/O related? Is it encoding related? Now you're screwed and you can only output the message of the error and pray that the message is accurate. yager.io/programming/go.html
Reading the sources is the worst excuse to make up for lacking documentation. Marshalling of data structures has been an issue from day one. It gets better, but it's still not rock solid.
>don't use ServeMux, but use httprouter instead!
It kinda sucks if the Go devs suggest not using the default implementation and revert to 3rd party libraries. That should be reason enough to fix the default implementation. At least they implemented HTTP2.

Go looks really interesting, but most of my programming is scientific stuff, Monte Carlo simulations and such. Does Go have good support for scientific libraries yet?

Adding to my last point: 3rd party libraries should complement the default library not replace it.

>java as an example of good documentation? it's a fucking mess IMO. it sucks.
Java has fantastic documentation, yo.
Every single class in the language has a good summary, and then an in-depth explanation of everything the class does.
Also whenever the language gets a new feature, incredibly thorough tutorials and guides are officially written. For example, for streams: oracle.com/technetwork/articles/java/ma14-java-se-8-streams-2177646.html

Go is cool and I really like the syntax and the creator, but IMHO they messed up the Go channels. One process goes down, all go down. And if one process dies, you can wait forever to get a reply if all things go wrong.

Go is basically a much cleaner C, which is pretty fast (even though Java is a tad faster). That's amazing if you consider how much optimization langauges like C or Java got. But nevertheless, Go's killer feauture are Go chanels and then they backpaddle and even say in the documentation that most problems can get solved better without Go channels..

I really like Go, but you just can't mess up the most important feature in a language like that. I'm just hoping they will make "Go v2" with better channels.

>1gb ram
that will barely fit hello world kek

...

>he literally made this

You're a waste of life. No one will ever love you.

>Go's killer feature are Go channels

No it's not, it's concurrency. Are you talking about Go routines? You have no idea wtf you're talking about, channels and routines are completely different. kys.

>C is unsafe. I would only use it for things like a jet aircraft

lol

Thankfully the people actually responsible programming jet aircraft actually opt for something with a modicum of basic memory safety most of the time.