12 ms·
The State of Go
- melling 11y agoNice little change in syntax. m := map[Point]string{ Point{29.935523, 52.891566}: "Persepolis", Point{-25.352594, 131.034361}: "Uluru", Point{37.422455, -122.084306}: "Googleplex", } may now be written as: m := map[Point]string{ {29.935523, 52.891566}: "Persepolis", {-25.352594, 131.034361}: "Uluru", {37.422455, -122.084306}: "Googleplex", }
- nickysielicki 11y agoI came into the comments to say that I very much dislike this change. I much prefer the extra syntax to not really knowing what '{29.935523, 52.891566}' actually means.
- deleted 11y ago[deleted]
- zachberger 11y agoIt's in the declaration of the map. Rewriting it over and over is redundant encoding
- axaxs 11y agoMuch agreed. Call me a masochist, but I prefer extra typing if it means readability, to me. And while subjective, retyping Point{} is much clearer to me than {}. It just looks...wrong.
- iokevins 11y agoThey seem to say you may choose to continue specifying it, as you prefer (?)
- nickysielicki 11y agoSure, I can write code the way I like. But the readability of code affects everyone, not just me. Still, 4ad's comment above mine changed my mind. I didn't consider that you can do this with structs already (in spite of the fact that I already do that in my code), and I prefer the consistency to the lack of verbosity.
- zak_mc_kracken 11y agoI'm puzzled about the asymmetry of the syntax. What's the reason behind map[Point]string as opposed to something more symmetrical?
- DrJokepu 11y agoIt makes sense if you're used to Go. In Go, in function declarations return types come after the argument list, e.g: func doSomething(input string) string { ... } The go map declaration syntax is analogous to the function declaration syntax: the keyword (map, analogous to the func keyword) followed by the type of the keys in brackets (analogous to the argument type in parentheses) followed by the type of the values (analogous to the return type).
- socceroos 11y agoI've never seen that explained so succinctly. Thank you.
- aikah 11y agomakes little sense but since go doesn't have user defined parametric types, it makes no difference. Now I wish I had 1 million dollars and a better brain to work full time on a proper language that would fix go's issues. What a missed opportunity to create something everybody would be comfortable with. It could have been the biggest language of the next 20 years in webdev, CSP is a great concurrency model. At least it will inspire some people in the future I hope. Rust is cool but doesn't have CSP builtin.
- enneff 11y ago> something everybody would be comfortable with Not possible.
- 4ad 11y agoThis worked for structs since a very long time, the change makes maps consistent too.
- giaour 11y agoShared libraries? I thought "no DLLs" was one of the major design philosophies of Go.
- vezzy-fnord 11y agoI was surprised too given the Plan 9 culture's rejection of dynamic linking. However, this will probably deprecate or diminish the RPC and code generation techniques for implementing plugin architectures.
- pjmlp 11y agoYet Limbo uses it everywhere.
- sacado2 11y agoYet Limbo is used nowhere. Now that's a paradox ! ;)
- pjmlp 11y agoDidn't you get the memo? It got revamped into Go after a conversation with Oberon-2. :)
- mseepgood 11y agoRobert Griesemer is the Oberon guy in the Go team. He worked for Wirth on Oberon at ETH Zürich.
- pjmlp 11y agoAnyone on the Oberon world should know that. :) I was lucky enough to be able to use Native Oberon back in the day.
- nickpsecurity 11y ago
- acomjean 11y agoPretty neat, go is now written in go "Go 1.5 has no C code in the tool chain or runtime.", go shared libraries interoperable with c. I'm really a go tinkerer, but I like the langauge. I didn't realize Garbage Collection was so expensive that the goal is to only have it run 20% of the time. But its a good goal. "Run Go application code for at least 40ms out of every 50ms."
- dbaupp 11y agoThat goal is referring to latency spikes. GC is usually much less than 20% of the time on average, but it may take, say, 200ms in one go and then run for 2 seconds without another collection. It seems their goal is to ensure there's no large pauses like that, so the 200ms would be spread across the 2 seconds as smaller time slices instead.
- danieldk 11y agogo shared libraries interoperable with c. How does this work? As far as I understand Go is moving to a copying collector, so any pointers passed to C may become wild pointers when garbage collection is performed. On go-nuts, Go's developers have been warning that passing arrays to C by getting the address of the first element of the slice will be unsafe for this reason.
- Daemon404 11y agoDang, I always figured that would be unsafe eventually. I wonder, does this make stuff like this unsafe: var thing C.thing; C.somefunc(&thing) i.e. can stack address change now?
- danieldk 11y agoThe Go spec does not contain the stack or heap, so I guess that in principle it's fair game for the collector to relocate it in memory. In some future version it's only safe to use memory in C-land that was allocated in C-land.
- 11y ago
- nkozyra 11y ago"Go 1.5 provides support for Android and experimental support for iOS." Tell me more ...
- nogostill 11y agoStill no generics, nor real type inference.
- melling 11y agoYou created a burn account just to complain about this? As you know, generics won't appear before 2.0, if ever. It's fine if that's a nonstarter for you. Perhaps you'll like Rust instead. It needs a big community too.
- chowells 11y agoWhy Rust? It doesn't really compete with Go anywhere. Haskell is a much stronger player in the space of high-level, garbage-collected languages. The only thing Rust and Haskell really have in common is not willfully ignoring the last 50 years of programming language design research.
- aplummer 11y agoDoesn't it? Why do people seem to compare them all the time...
- TazeTSchnitzel 11y agoRust is a systems-level programming language. Go isn't: it's garbage-collected.
- sacado2 11y agoLisp is garbage collected. Yet Lisp machines existed, and they were invented at the same time as UNIX.
- nickpsecurity 11y agoAnd some's details were published for other people to learn from. Anyone wanting to see how they implemented it can google LISP and Scheme machines, hardware, processors, and similar search terms. I recall one implemented cons directly while hiding GC behind memory interface. The programs didn't even know there was collection and it happened in parallel with execution without stopping execution. Great stuff. Many of these give software and hardware implementation details where they could be copied in FPGA's. Closest thing I've seen in a modern product is Azul Systems' Java processors with concurrent GC's. So, at least one company is benefiting from the old wisdom.
- sanderjd 11y agoThe analysis and tracing tools look really wonderful. Have those been in the works / maturing for awhile, or is that all new tooling for 1.5?
- jdoliner 11y agoI think the tracing tool [0] isn't go specific but rather just a general tracing tool that's been maturing for a while. The support for outputting compatible traces is new to 1.5 AFAIK but that would explain how they have such a nice looking interface already :) [0] https://github.com/google/trace-viewer https://github.com/google/trace-viewer
- 4ad 11y agoThe trace viewer is not Go specific, it comes from the chrome browser, but of course the technology that makes it possible to trace Go is very Go-specific.
- deleted 11y ago[deleted]
- frik 11y agoShared library support, thanks!
- petesoder 11y agoIf you're interested in the full talk, we'll have the vid posted at https://www.hakkalabs.co/meetups/gosf https://www.hakkalabs.co/meetups/gosf within a few days or so.
- ori_b 11y agoHow does shared object support interact with cross-module inlining?
- rajeemcariazo 11y agoplease tell me how to make such slide presentation
- mseepgood 11y agoUse Go's "present" tool: https://godoc.org/golang.org/x/tools/present https://godoc.org/golang.org/x/tools/present
- rifung 11y ago"Go 1.5 provides support for Android and experimental support for iOS." I thought this day would never come.
- Yuioup 11y agoI seriously was wondering if Go would ever replace Java on Android because of legal troubles. I'm still wondering.
- izacus 11y agoThat will happen as soon as Android team decides to scrap all development of Android and rewrite it in Go.
- castell 11y agoIt could also happen that ChromeOS and Android merge with Go as native language and HTML5 apps as another first class citizen. I read in then news that iOS9 will use Swift in some internal apps/libraries too (major internal rewrites?).
- namelezz 11y agoI wonder how Go can be better than Swift for iOS development.
- danieldk 11y agoI think the attractiveness is that you can share Go code between applications on different platforms, which is not possible with Swift as long as the compiler and standard library is not open source (or generally available).
- kainosnoema 11y agoIt may not always be better since you'll likely never be able to call from Go into Cocoa libs, but if you can write a shared library and use it on the server, iOS and Android, then it's a big win. Linking a Swift app against the shared Go library and calling directly from Swift into Go sounds pretty great to me.
- amelius 11y agoSlide 10 shows the benchmark differences, and I found them a little suspect. The "binary tree" benchmark is the only one that is 25% worse than the old version, but in my opinion it is an important benchmark, because I suppose that this benchmark actually creates a lot of objects that need to be garbage collected. At least that is what I suppose, based on the fact that this holds for binary tree algorithms. The other benchmarks are mostly about formatting and regexping, which require much less objects to be created on the heap, and these are making the benchmarks look better.
- pcwalton 11y agoYes, if it's referring to Boehm's binary-trees benchmark (as seen on the benchmarks game, for example), it is explicitly designed to be a benchmark of garbage collection. I believe the Boehm GC was tuned using it.
- masklinn 11y ago> Slide 10 shows the benchmark differences, and I found them a little suspect. To be fair, they follow a slide about general performance, 4 slides after the GC slides. And from the concurrent GC slide it looks (as one would expect) that the GC burns significantly more resources overall (it's not just longer wallclock), though it rarely completely stops the world anymore: on the right-hand side, where the old GC would burn 1 unit of CPU for 240ms (3 * 80ms), the new one burns half a unit of CPU for 900ms (plus a unit for 2ms), which mean it's using 452ms of CPU, close to twice as much as the old one. Though the application pauses significantly less (which is good for responsivity), that's CPU time it doesn't get to use anymore. The concurrent GC also "leaves off" more work for later, the left-hand side graphs show relatively low CGC use for the first 7s, followed by a spike and then much, much longer GC runs (though at progressively lower CPU%). I don't know about others, but it was my expectation that overall performance would take quite a hit for GC-heavy applications in 1.5.
- enneff 11y agoOf course, as with whenever you change something fundamental like this, some programs will get slower while others get faster. That's the nature of trade offs. It's not really suspect. The benchmarks reflect execution speed. The new GC trades a little raw throughput for lower GC latency. So you would expect a GC-heavy benchmark to show the greatest speed loss. What matters for go users, though, is the behaviour of real programs. Real programs benefit from the reduced latency of the GC and other compiler optimisations we have made since 1.4. The outcome, in our measurements, is roughly equivalent performance for most programs but with significantly shorter GC pauses.
- sergiotapia 11y agoNot that I'm complaining but it this a coordinated effort to push Go to the front page? There are literally 6 submissions on the front page related to Go - what gives?
- barsonme 11y agoGo's SF meetup just finished. https://news.ycombinator.com/item?id=9609427 https://news.ycombinator.com/item?id=9609427
- castell 11y agoThe same was true during the Microsoft Build event, the difference was that a lot of Microsoft employees registered a new (green) HN account. Not that I'm complaining but it looked more like a coordinated effort than Go language which has minimal PR from Google but is used by many devs around the world and is very big in Asia.
- seanmcdirmid 11y agoThere are a lot of MS employees on HN normally, no need for green accounts. Also, where is Go popular in Asia? I haven't heard much about it in China (it isn't a resume point yet).
- AYBABTME 11y agoThat's odd, from within the Go community it's understood that there's a rather large followership in China. At least, speaking for myself.
- seanmcdirmid 11y agoI've heard this to, but haven't observed it in my part of the industry (systems/PL research with lots of undergrad and grad interns from top ranked schools, who are usually the PL early adopters). Scala has been getting more interest lately, and there is growing interest in Rust.
- est 11y agoI always have this question: Since a large project like Golang has so many auto-build tools and test OSes, how hard is it to provide a binary download for e.g. Ubuntu 14.04 LTS? You know, not tarballs, but actual static binaries as deb packages installable via apt-get. Good examples: http://wiki.nginx.org/Install http://wiki.nginx.org/Install https://www.percona.com/doc/percona-server/5.6/installation/apt_repo.html https://www.percona.com/doc/percona-server/5.6/installation/... I root for open source movement, but to install something on a popular arch/OS by compiling from source everytime is just meaningless power consumption and adding CO2 emissions.
- favadi 11y agoIf you don't have experience with packaging, https://github.com/jordansissel/fpm https://github.com/jordansissel/fpm is probably your best bet. And it is super easy to use.
- moondowner 11y agoTry this https://github.com/geosoft1/tools https://github.com/geosoft1/tools (related blog post: http://www.webupd8.org/2014/09/easily-install-latest-golang-compiler.html http://www.webupd8.org/2014/09/easily-install-latest-golang-...)
- insertnickname 11y agogolang.org offers two types of downloads for Linux: a source tarball and a pre-compiled tarball. If you download the pre-compiled tarball, you just have to extract it somewhere and set some environment variables (all explained in detail on golang.org). If you really want to install Go via your package manager, you can install the golang package from the Ubuntu repositories. However, this package is naturally on an outdated version of Go. Also worth mentioning is godeb[1] which can generate and install a .deb of any version of Go for you. [1]: http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-go http://blog.labix.org/2013/06/15/in-flight-deb-packages-of-g...
- est 11y ago> extract it somewhere and set some environment variables That's exactly the problems package would solve, well, plus easy update capabilities.
- tracker1 11y agoWith go 1.5 able to build to static/dynamic C libraries, I wonder how long it will be until there is a bridge to be able to easily write binary modules for Node.js ... Which may seem a bit crazy.
- advanderveer 11y agoWas hoping for some news on vendoring, the discussion on the mailing list didn't really end with any actionable conclusions.
- dvirsky 11y agoOh man, dynamic loading of Go libraries is going to be awesome. I'm in the process of developing an http API framework/server (yes, yet another one, but why is a different topic). This will allow me to compile the actual APIs running on the server (multiple APIs can run on one server) as shared libraries and have the server automatically start them.
- abetusk 11y agoAs far as I know there is still no easy facility to dynamically load libraries at runtime (like the analogous 'dlopen' in C). There are shared libraries and they can be linked at compile time so it's a step in the right direction.
- dvirsky 11y agoThe spec that's linked from the presentation says that it should be possible (and has an example API usage). Unless they didn't implement it fully, of course, or it's due for a later Go version. > to support Go packages that want to use plugins, a new package will be added to the standard library: plugin. It will define a function and a type. https://docs.google.com/document/d/1nr-TQHw_er6GOQRsF6T43GGhFDelrAP0NqSS_00RgZQ/edit?pli=1 https://docs.google.com/document/d/1nr-TQHw_er6GOQRsF6T43GGh... [EDIT] I looked at the commits and it looks like it's not in the works, at least on the main repo.
- olov 11y agoLive stream recording here: https://youtu.be/Fx304EfqtMo?t=395 https://youtu.be/Fx304EfqtMo?t=395
- lake99 11y agoI was surprised to see Plan 9 still supported. Are there any core Go developers who still use Plan 9 as one of their primary work machines? Is Plan 9's userbase growing?
- marktangotango 11y agoGo uses ports of the Plan 9 system libraries extensively, so Plan 9 support is probably a freebie, or implicit.
- bshimmin 11y agoRob Pike, maybe?
- bshimmin 11y agoI take that back: http://rob.pike.usesthis.com/ http://rob.pike.usesthis.com/
- rsc 11y agoWhat's the rationale for not supporting it, given that the work is done and the maintenance burden is minimal?
- lake99 11y agoI can't offer a rationale, because I have no say in the matter, or even a preference, one way or another. I asked out of mere curiosity. But if you were to tell me that the Go team dropped support for Plan 9, for the same reason they dropped support for dragonfly/386 and OSX 10.6, that explanation would have a very low entropy for me, because apparently, the last release of Plan 9 was in 2002.
- rsc 11y agoPlan 9 is still updated incrementally; there just hasn't been a formal new numbered release. Dropping Dragonfly/386 and OS X 10.6 would be more like dropping the 3rd edition of Plan 9 (except we never supported it).
- ubercore 11y agoAt the risk of lazy-web, I just came off an attempt at writing a small service in Go. I liked the language, but found vendoring and package/dependency management sucked most of my time, and I never reached a workable conclusion. I'd really like to give Go another, heh, go. I know it's an open topic, and there's no true "one way", but I'm wondering how people here would handle this situation. And perhaps it's my Python-addled brain that's the problem, since GOPATH is kinda sorta like PYTHONPATH, maybe enough to confuse me. I have a repo at github.com/user/repo. It consists of independent but related applications, most in Python, one in Go. The Go project would be rooted in a "service" subdirectory. I feel like I'm really missing some critical piece of a Go workflow, because I could never get that to build reliably when I started adding external libraries as a dependancy. It seems like I'd have to put the project in github.com/user/repo/service/src/github.com/repo/service, which is what makes me think I don't understand what I'm talking about! To bring this rambling lazyweb back on topic, I guess I was a little disappointed that vendoring/packaging wasn't mentioned in this state-of-Go talk. I was really hoping I could easily give Go another shot, but in the absence of that, anyone have a suggestion for my setup above?
- virulent 11y agoI have a similar feeling. I don't really like GOPATH, but I'm trying to come to terms with it. Your Go "project" goes in $GOPATH/src, i.e. your git repo would be in $GOPATH/src/github.com/user/repo If you have your main pkg in $REPO/service, then you can build like so: go build github.com/user/repo/service (this can be ran from anywhere as it uses $GOPATH) If you need to add a dependency, use: go get github.com/.... and go get will add it to $GOPATH/src/ which you can then import.
- ubercore 11y agoHmm, ok. I think I get that -- I'll have to see if I can symlink into the GOPATH; I feel like I read somewhere you can't. I'd like to avoid making my GOPATH be a subdir in the containing repo. Thanks!
- kzvezdarov 11y agoThere are some good dependency managers out there. I personally like gb: http://getgb.io/ http://getgb.io/, but there is GoDep and GPM as well (which are more similar to Rust's Cargo in the way they work).
- fitzwatermellow 11y agoFrom the penultimate slide, a list of upcoming Golang community conferences: GoCon - Tokyo, Japan - June 21 http://gocon.connpass.com/event/14063/ http://gocon.connpass.com/event/14063/ GopherCon - Denver, Colorado - July 7-10 http://www.gophercon.com/ http://www.gophercon.com/ GolangUK - London, UK - August 21 http://www.golanguk.com/ http://www.golanguk.com/ GothamGo - New York, NY - October 2 http://gothamgo.com/ http://gothamgo.com/ dotGo - Paris, France - November 9 http://www.dotgo.eu/ http://www.dotgo.eu/