News for hackers. Stuff that matters.
Re:Moving from Go to PHP Again by oconnor663 on Friday February 08, 2019 @02:12AM (#19112153)
Personally I found it too easy to accidentally forget to check an error, or to shadow a named error return, or to create a nil error that doesn't compare equal to nil. Also to write a method that appears to mutate the receiver but which in fact copies it.
Re:Moving from Go to PHP Again by agnivade on Friday February 08, 2019 @03:04AM (#19112337)
> I found it too easy to accidentally forget to check an error

Use https://github.com/kisielk/errcheck for that.

Or prefer https://staticcheck.io/ for a larger set of checks.

Re:Moving from Go to PHP Again by apta on Friday February 08, 2019 @11:09AM (#19115520)

    fmt.Println("foo")
I don't see errcheck complaining there

how about (taken from here: (https://www.reddit.com/r/programming/comments/ak305l/goodbye...):

    r1, err := fn1()
    r2, err = fn2()
    if err != nil {
      return err
    }
err check doesn't complain either
Re:Moving from Go to PHP Again by oconnor663 on Friday February 08, 2019 @01:47PM (#19117389)
That second example is really surprising. This sort of thing happens all the time in production when lines get moved around. Does anyone know why errcheck misses it?
Re:Moving from Go to PHP Again by agnivade on Tuesday February 19, 2019 @12:20AM (#19196794)
Not sure about that. But https://github.com/gordonklaus/ineffassign catches that.
Re:Moving from Go to PHP Again by spdionis on Friday February 08, 2019 @04:19AM (#19112648)
use an IDE
Re:Moving from Go to PHP Again by rnvhhynr on Friday February 08, 2019 @06:46AM (#19113353)
What's a good IDE for Go? Something that's snappy and fast, no Java dinosaurs please
Re:Moving from Go to PHP Again by 12298765 on Friday February 08, 2019 @09:11AM (#19114232)
I mean GoLand is pretty good, but I do also like IntelliJ, so YMMV if you don't like the JetBrains products. And it isn't free.

VSCode is also really good for Go, I was surprised. There are plugins that massively help with testing, syntax checking, error handling, etc. I think it actually catches more issues than GoLand!

Re:Moving from Go to PHP Again by rnvhhynr on Friday February 08, 2019 @09:18AM (#19114289)
I've tried VSCode but it seems to require you to install Go... It can't even find the declaration of a variable or the definition of a function without Go, while Sublime can.
Re:Moving from Go to PHP Again by xdfgd0ig0dg on Friday February 08, 2019 @09:17AM (#19114274)
Visual Studio Code with the official go extension is really great and snappy
Re:Moving from Go to PHP Again by geoka9 on Friday February 08, 2019 @11:47AM (#19116041)
Emacs with go-guru.