News for hackers. Stuff that matters.
Re:The Go Programming Language by Brian W. Kernighan, Alan D... by aikah on Thursday March 05, 2015 @05:33PM (#9154344)
I have mixed feelings about Go.

For those who didn't try it yet here are the biggest advantages of Go:

- it's totally easy to learn and can be mastered in a day

- it's fast and typesafe

- the concurrency model is great,no question

- I personally like the error system, no exceptions but you can still "bubble up" errors with multiple return types

- it has, in my opinion a comprehensive standard library,you can even do websockets and image compression with it.

The draw backs :

- no generics clearly the biggest drawback, which means a lot of copy and paste

- the lack of idiomatic way to deal with dependencies(no defacto package manager)

I think the ease of use justifies Go adoption in any team. It doesn't replace ruby or python for web programming ( little value in coding a CMS in Go , rails makes more sense),but when it comes to backend or webservices, it's a killer tool.

compared to java, it's as fast and consumes WAY less memory.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by CatDevURandom on Thursday March 05, 2015 @06:08PM (#9154524)
> which means a lot of copy and paste

Again, I don't think Go is perfect but on my list of wants, generics are not in the top 5. Can you qualify "a lot" in a real project you've worked on? Because after writing a good chunk (over 50k lines) of Go code, I haven't felt the sting as much as I hear it complained about.

> the lack of idiomatic way to deal with dependencies(no defacto package manager

Again, is this really a big deal? There's plenty of options, and if you are shipping any-type of commercial product you are going to want to be vendoring your dependencies in-house anyway. In which case, depending on something like NPM/remote maven repos is not a viable options anyway.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by cgag on Thursday March 05, 2015 @08:29PM (#9155052)
All the for loops and array indexing you do in place of simple map / filter / reduce calls would count in my definition of copy and pasted code.
Re:The Go Programming Language by Brian W. Kernighan, Alan D... by rubiquity on Thursday March 05, 2015 @06:32PM (#9154648)
> Again, I don't think Go is perfect but on my list of wants, generics are not in the top 5.

Would you mind sharing your top 5 wants? I'm interested.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by CatDevURandom on Thursday March 05, 2015 @08:15PM (#9154994)
Sure! In order:

A Debugger.

Better IDE options.

Binary sizes small enough to use for embedded programming.

Pauseless Garbage Collector.

Less awkward variable declaration.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by bsg75 on Friday March 06, 2015 @11:10AM (#9157739)
> A Debugger

https://golang.org/doc/gdb (some limitations IIRC)

https://github.com/derekparker/delve (a work in progress, but promising)

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by sigmaml on Friday March 06, 2015 @01:46AM (#9155903)
I documented a real-life experience here: http://oneofmanyworlds.blogspot.in/2014/01/another-go-at-go-....

Read the requirement, elaborate a little more by me in some of the comments, and see how the combinations I had to deal with quickly multiplied to cause high tedium.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by BuckRogers on Thursday March 05, 2015 @06:45PM (#9154697)
I'm in a similar boat. I've tried Go, and partially agree with your sentiment that the ease of use justifies usage of it in any team. Even with its flaws, it's a tempting feature. But I'm not sure if bringing -anything- into an existing stack should be done lightly though since someone has to maintain whatever is brought in. Even if the ramp up time is shorter than usual.

For backend/webservices, I initially tended to agree Go is a killer tool. But if you are a Python shop, why would I bring this into my stack instead of using PyPy (or soon, Pyston) for CPU-intensive tasks? I say this as someone who has never really ran into issues with Python performance, but am looking towards learning Rust once it hits 1.0 for writing my first non-Python library because if I can find something CPU intensive enough, I can justify deep diving on Rust.

Doesn't mean I won't ever run into performance issues, but even Rust may not be necessary (for me), with PyPy/Pyston around. Go itself is more a replacement for other tech, rather than complimentary, which in my view is the biggest drawback not on your list. I like things with big ecosystems that work well together so you're not stuck on an island, and the Python/C(++)/Rust world has great interop. Unless you're a true Go diehard about the language for whatever reasons, this isn't really what I think many like myself are looking for. I see more value in simply adopting another implementation of a shop's existing platform, if you have so many options at least.

I'll be really interested to hear responses to this, as I don't feel interop with Go has been discussed often. Seems people who really like Go are either 'all in' or not at all, figuratively and literally.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by unoti on Thursday March 05, 2015 @08:09PM (#9154974)
> For backend/webservices, I initially tended to agree Go is a killer tool. But if you are a Python shop, why would I bring this into my stack instead of using PyPy (or soon, Pyston) for CPU-intensive tasks?

Two big things here, for my applications.

1. Memory. You mention CPU use, but memory use is even more critical for what I do. For game servers, for example, lower memory usage for an application can change the multipliers on how many users I can handle per server. This can make a dramatic (like 20x) difference in what you can offer users for free vs charging.

2. Static compilation. This makes a massive difference over Python in terms of catching and correcting problems at compile time vs run time.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by arthurtw on Thursday March 05, 2015 @09:16PM (#9155218)
> 2. Static compilation. This makes a massive difference over Python in terms of catching and correcting problems at compile time vs run time.

Correct. When comparing a static programming language to a dynamic one such as Go vs Python, this is a critical difference. It impacts system stability (production outage rate) and code maintainability a lot, the two characteristics a long-running product desperately needs.

But Go is not comparable to C. Go is garbage-collected, so unlike Rust, it is not a true system programming language (i.e. not low-level enough). On the other hand, it is not high-level enough. It lacks many advanced language constructs, and its type system is rather limited. Simplicity is a big merit of Go, but it's too limited IMO.

Go solves many software development problems for large engineering teams, so I think its ecosystem will keep growing for a while.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by wallyhs on Thursday March 05, 2015 @07:51PM (#9154921)
Don't forget about the tooling: unit testing, benchmarking, generated documentation, code formatting, and emacs+vim plugins are included in the official package. I think these are often overlooked when describing its benefits. You can jump in and start working right away.

In discussions about error handling in Go, I rarely see mention of panic used for private exception handling. If a module exposes a small surface area, the public entry points can recover from panics and return them as errors. Private functions can then use panic to report errors:

  func PublicEntryPoint(input string) (output []byte, err error) {
    defer func() {
      if e := recover(); e != nil {
        output = nil
        err = e
      }
    }()
    err = nil
    output = privateFunc(input) // no need to check for error here
    return
  }
  func privateFunc(input string) []byte {
    foo := otherPrivateFunc(...) // no need to check for error here
    // ...
  }
  func otherPrivateFunc() int {
    // ...
    panic(fmt.Errorf("Something is wrong"))
  }
I would panic-recover a specific type of error instead of the generic "error" type, but I'm simplifying for the example. Also, it is not recommended to panic across module boundaries.
Re:The Go Programming Language by Brian W. Kernighan, Alan D... by ascotan on Thursday March 05, 2015 @08:19PM (#9155016)
I sort of agree with the go authors that there is not idiomatic way to deal with dependency management at all. (see: https://golang.org/doc/faq#get_version) They all have their ups/downs and mostly it has to do with the language they are supporting.

Nodejs:

+ transparent code on download

- virtually impossible to mirror

- executes arbitrary 'script' blocks that install stuff on your system

- subpar transitive dependency management scheme

Java:

+ great transitive dependency management

+ private repos/mirrors are easy with well supported tools

- black box byte code with no licenses

- overly complicated software (ivy/maven)

Python (pip):

+ simple and easy

- virtual environment hell

There are things that i like and don't like with go get:

+ dirt simple and used from the command line

+ code comes into src/. This means that you can see the code and the licenses that you are pulling in. This makes it easy to inspect code in your project. I don't have a hidden code repo in my home directory or some crap.

+ I can clearly see the licenses that i'm pulling in. If you have a GPL in your project it's pretty trivial to audit this (unlike other tools were you have to track down the homepages of 20 random people).

- code is pulled from HEAD. Frankly this sucks. Hopefully people get their act together and release their software and got get will be able to pull a release. I can see the advantage of pulling from head if you're constantly iterating and monitoring for fixes. However, pulling from HEAD introduces the risk that there is a major untested defect in what you just pulled.

Overall as long as there is not a huge chain of dependencies in the code that you're pulling, and as long as you're relatively confident that HEAD isn't going to bust you release, it's a great system. Honestly I think that it makes the developer more wary about pulling in random half-baked code from the internet into their project. Maybe that's a healthy thing.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by nothrabannosir on Thursday March 05, 2015 @08:26PM (#9155037)
go get first searches for a go1 branch or tag and pulls from that, if present. master branch is only a fallback.
Re:The Go Programming Language by Brian W. Kernighan, Alan D... by doomrobo on Thursday March 05, 2015 @09:16PM (#9155221)
Is it truly typesafe if the interface{} idiom is commonly used in lieu of real generics?
Re:The Go Programming Language by Brian W. Kernighan, Alan D... by semi-extrinsic on Thursday March 05, 2015 @06:06PM (#9154517)
The lack of a package manager is a good thing, since this is the job of the operating system. That Windows and OSX have crappy/nonexisting package managers does not mean every language should roll its own.

If the police in your city are not doing their job, you shouldn't resort to vigilantism, you should stage a protest. Ideally.

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by shanemhansen on Thursday March 05, 2015 @08:20PM (#9155018)
Package management is the job of the operating system, but this statement doesn't make much sense for go because go binaries are statically linked to go packages. So using an OS-provided version of crypto/tls or net/http isn't really an option.

Go dependencies are basically a build-time thing.

(cgo is an exception)

Re:The Go Programming Language by Brian W. Kernighan, Alan D... by pjmlp on Friday March 06, 2015 @02:04AM (#9155950)
Are you aware how many OSs are out there?