Live data from Hacker News

Go 1.13 Release Notes

golang.org

41–50 of 264 posts

Re: Go 1.13 Release Notes

#41

I actually just started to use go on windows just to check it out. First impressions from a newbie: - Getting started with go and vscode is kinda bad right now. I installed go, set up GOPATH, installed all kinds of extensions in vscode and then, somewhere down the official tutorial I learn about GO111MODULES, go mod init, vendor folders and the language server... I was completely confused and still am. I removed all…

> - Why does go need := with the colon? I know it's a declaration, but I haven't figured out the reason for the colon.. Seems weird..

With ":=" will declare with implicit type and then assign. The type will be that of the right hand side.

Re: Go 1.13 Release Notes

#42
post #36

Earlier quoted context omitted.

> Why does go need := with the colon? I know it's a declaration, but I haven't figured out the reason for the colon.. Seems weird.. It's called a short variable declaration that can be used in place of `var` and the type is implicit. var s string s = "foo" vs s := "foo"

I know. The question is, why does it need a colon? It seems completely superfluous, from a syntax perspective.

I think the point is to make sure you know what you are doing. That declaring a new variable should always be an intentional act, and this makes assignments to typoed variable names error rather than just creating a new variable.

Re: Go 1.13 Release Notes

#43
post #36

Earlier quoted context omitted.

> Why does go need := with the colon? I know it's a declaration, but I haven't figured out the reason for the colon.. Seems weird.. It's called a short variable declaration that can be used in place of `var` and the type is implicit. var s string s = "foo" vs s := "foo"

I know. The question is, why does it need a colon? It seems completely superfluous, from a syntax perspective.

It catches some coding errors due to mispelling. Did you mispell an existing variable or wanted to declare a new one.

Re: Go 1.13 Release Notes

#44
post #36

Earlier quoted context omitted.

> Why does go need := with the colon? I know it's a declaration, but I haven't figured out the reason for the colon.. Seems weird.. It's called a short variable declaration that can be used in place of `var` and the type is implicit. var s string s = "foo" vs s := "foo"

I know. The question is, why does it need a colon? It seems completely superfluous, from a syntax perspective.

it's not. Go has block-level scoping. = means "assign the existing identifier to this value". := means "create a new identifier".

https://play.golang.org/p/Irqxm0okfkt

Re: Go 1.13 Release Notes

#45

I like the way Go proceeds as a language, with features added very very slowly and the compiler and tools regularly improving. I hope Rust can settle down into a similar focus soon.

Rust moves slowly too. I'm not sure where the idea that Rust makes changes willy-nilly came from, but anyone saying that is deeply unfamiliar with the RFC process. It's extremely hard to get new features into Rust.

Perhaps it's the number of things changing that leads to the feeling of rapid movement. After all, 60 1mph increases are all tiny by themselves.

Not sure if that's true or not though. Rust is my daily driver for the last year and even coming from Go (after 6 years) I don't feel the pace is hard to keep up with, or that my code breaks frequently.

In fact, I don't think my code has broke as a result of changes once since I switched to Rust. It has happened .. twice maybe, via dependencies, though.

Re: Go 1.13 Release Notes

#46
post #39
post #38

Earlier quoted context omitted.

Hmm... do you really hardcode big numbers that often?

You mean, do I work with binary constants? Yes.

I think the question was more around how often is 0b1100 useful outside of a block of consts at the beginning? Surely you're not typing out long constants manually that often?

Re: Go 1.13 Release Notes

#47

I actually just started to use go on windows just to check it out. First impressions from a newbie: - Getting started with go and vscode is kinda bad right now. I installed go, set up GOPATH, installed all kinds of extensions in vscode and then, somewhere down the official tutorial I learn about GO111MODULES, go mod init, vendor folders and the language server... I was completely confused and still am. I removed all…

> Getting started with go and vscode is kinda bad right now. I installed go, set up GOPATH, installed all kinds of extensions in vscode and then, somewhere down the official tutorial I learn about GO111MODULES, go mod init, vendor folders and the language server... I was completely confused and still am. I removed all extensions except the main one from vscode and the language server was crashing like crazy until I unset GOPATH. Works now, mostly. Intellisense and code formatting seems to be still unstable now and then. But geez, that first experience was horrible.

Yeah, there are a lot of reasons for this. Things used to be easy when it was just GOPATH, but that didn't support every use case, so modules were added. Now the advice beginners get is fragmented and confusing to navigate. Also, the error messages for modules are terrible. These are tractable problems, but it's definitely a rough time to be a beginner (which is unfortunate because Go is otherwise very beginner-friendly).

VS Code is a different product altogether and its Go integration is pretty buggy in my experience, especially its handling of modules. Go really needs a bullet-proof (free) editor story. If you want a premium IDE (a la Visual Studio), I've heard good things about Goland.

> Need to get used to error handling.. It can get really verbose and those scoping rules are strange.. I miss exceptions, but I can get used to the go way.

The scoping rules are pretty straightforward and standard. I'm guessing "shadowing" is tripping you up. Error handling is verbose, but this is a good thing IMO; it's really clear what is happening and there is no special control flow for certain data that is arbitrarily classified as an error. The real issues with errors are the lack of stack traces and other standard structures for programmatically inspecting / manipulating errors. Some of these issues are being addressed in go1.13 but it will take a while for the best practices to be established and propagated through the community.

> Sorry for the rambling. I love the simplicity of the language and hope to get into it more. But the initial experience is still, umm, not streamlined, it seems? But I hope that's just temporary.

I think it will be. You're entering at a time when there's some churn in the best practices and it makes for a confusing time to be a newbie. Hang in there!

Re: Go 1.13 Release Notes

#48
post #29

How does Go compare to Rust these days with respect to language maturity, community size and general maturity/availability of libraries? So far I've found Rust more interesting and pushes the envelope a bit more. But what is the sales pitch for Go?

“Go is to services what Rust is to systems.”

Without cargo though

Re: Go 1.13 Release Notes

#49

I like the way Go proceeds as a language, with features added very very slowly and the compiler and tools regularly improving. I hope Rust can settle down into a similar focus soon.

Rust can't settle down right now, because it still has to make necessary changes to critical parts of the language, such as async.

Go always had a very narrow and precise ambition and scope (a better C, aimed at server-side data plumbing). Which is the reason why it was able to nail a set of features from the start and keep it that way.

Rust has a much wider ambition : all the modern languages facilities (generics, metaprogramming, etc) with the speed of C, AND breakthrough memory-safety features.

Go doesn't try to innovate, and i suppose the author see innovation as something you should stay away until it's nothing new anymore.

Re: Go 1.13 Release Notes

#50
post #14

I occasionally use Python for large-scale processing of structured data (XML, JSON) and the data's really messy as you'd expect (malformed responses, missing fields, normalisation, etc..). One of the things putting me off of Go for these kinds of projects is it's much more verbose/harder to handle edge cases - it feels like I'm less productive writing the program, but end up building something much more stable than t…

> is it's much more verbose/harder to handle edge cases - it feels like I'm less productive writing the program, but end up building something much more stable than the Python equivalent This is exactly how I felt moving from a Python codebase to Go. But you realize on the 100th or so Python stacktrace that it's worth the investment up front, if not for type safety alone. > I really need the performance for my worklo…

> In the particular cases of parsing XML and JSON, I'd wager Python is much faster, actually.

Up until you need to do anything interesting with the deserialized data. :)

Post reply on HN