[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I want to learn it.

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 60
Thread images: 6

File: golang.png (47KB, 1634x2224px) Image search: [Google]
golang.png
47KB, 1634x2224px
I want to learn it.
>>
https://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.
>>
>>56595720

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.
>>
>>56595779
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 (https://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.
>>
>>56595682
>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.
>>
>>56595981
concurrent network software
>>
>>56596031
erlang is cooler
>>
>>56595981
It seems like a good language to learn.
>>
>>56595682
if pajeet can do it, I'm sure you can too, OP.
>>
>>56596019
can you share your plugins?
>>
>>56596019
for learning is it okay to use a 1gb and atom processor netbook?
>>
>>56596913
yes
>>
>>56596913
yes, cool thing about Go is it compiles super fast.
>>
>>56596984
>>56597019
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++.
>>
>>56595682

bump.
>>
>>56597019
and that you can include C scripts
>>
Read the documentation on the Go website and be amazed how poorly the language is designed.
>>
>>56595720
>Atom
Kek'd.
>>
>>56598959
>poorly
that's a funny well to say "well"
>>
>>56599237
Name one unique selling point about Go.
>>
>>56596906
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()



http://pastebin.com/raw/S9ebLQ8a
>>
>>56599348
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.
>>
>>56595779
$GOPATH=$HOME
nigga please
>>
>>56599348
-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++
>>
>>56599505
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.
>>
>>56599833
>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
>>
>>56599833
>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
>>
>>56599833
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.
>>
>>56599894
He makes a valid point on the nil checks on errors though
>>56599833
>>
>>56599348
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.
>>
>>56599957
No, he doesn't, because in the enterprise robust error handling is important.
>>
>>56599957
would you rather write 50% exception/try/catch blocks in your code?
>>
>>56599458
Thanks friendo
>>
>>56599894
>>56599897
>>56599932
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. >>56599989 explicit error checking is just as bad as C style error codes. I seriously hope you agree with me on that.
>>56599982
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.
>>
>>56597240
>there an available autocompletion elisp for go-lang?, like co

yep i have company-go backend which uses go-code
> https://github.com/nsf/gocode
>>
>>56600271
>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.
>>
>>56600271
Rust is a mess. Learn go.
>>
>>56600271
>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.
>>
>>56595682
https://tour.golang.org

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

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

>>56598959
>>56599348
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.
>>
File: 1473382879193.gif (1MB, 320x240px)
1473382879193.gif
1MB, 320x240px
>>56600302
neat. thx.
>>
>>56595682
Why would anyone learn this? Seriously, what's its purpose?
>>
>>56599833
http://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully
http://dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package

>>56600574
ask the people/companies behind these projects:
https://github.com/avelino/awesome-go
>>
>>56600596
Literally a non-answer.
I want to know why should I use this over say python or C or Java
>>
>>56600328
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.
>>56600329
Go is a mess. Learn Pascal.
>>56600402
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.
>>56600478
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.
>>
>>56600641
read the thread? at least 4 posts ITT give some pros/cons of Go.

>>56600651
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
>>
https://www.golang-book.com/books/intro

https://code.visualstudio.com/

https://github.com/Microsoft/vscode-go

You're all set now.

>>56600651
>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.
>>
>>56600641
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.
>>
>>56600651
go supports rpc
>>
>>56600596
>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. http://yager.io/programming/go.html
>>56600695
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.
>>56600696
>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?
>>
>>56600887
Adding to my last point: 3rd party libraries should complement the default library not replace it.
>>
>>56600695
>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: http://www.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.
>>
>>56596913
>1gb ram
that will barely fit hello world kek
>>
File: go.png (130KB, 1634x2224px) Image search: [Google]
go.png
130KB, 1634x2224px
>>56595682
>>
>>56603563
>he literally made this

You're a waste of life. No one will ever love you.
>>
>>56603370
>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.
>>
>>56600719
>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.
Thread posts: 60
Thread images: 6


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.