11 ms·
Go 1.5 is released
- tmaly 11y agocool, looking forward to testing it out.
- deleted 11y ago[deleted]
- travjones 11y ago>"The compiler tool chain was translated from C to Go, removing the last vestiges of C code from the Go code base." This is really cool. Writing a compiler in the language that you're compiling seems kind of meta. The language has evolved to a point to where it can consume and build itself. Far out mannnnn. Thanks Go team!
- mrdrozdov 11y agoPerhaps this is a dumb question, but what language was used to compile the compiler? Was it compiled in C? Surely it must have had to of been compiled in a different language somewhere down the chain.
- crawshaw 11y agoIt is built with Go 1.4. Details: https://golang.org/s/go15bootstrap https://golang.org/s/go15bootstrap
- whacker 11y agoThe 1.5 build requires you to have a go1.4.2 build which is used as the bootstrapping compiler.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- rgbrenner 11y agoyes.. golang's compiler was originally in C. The process is called bootstrapping: https://en.wikipedia.org/wiki/Bootstrapping_(compilers) https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
- turtles99999 11y agowell, it's actually turtles all the way down.
- frou_dh 11y agoThere is a good presentation from Pike talking all about the what/why/how of the C -> Go transition: http://youtu.be/cF1zJYkBW4A http://youtu.be/cF1zJYkBW4A http://talks.golang.org/2015/gogo.slide http://talks.golang.org/2015/gogo.slide
- jlees 11y agoAlthough you can end up with fun situations like the C compiler backdoor: http://scienceblogs.com/goodmath/2007/04/15/strange-loops-dennis-ritchie-a/ http://scienceblogs.com/goodmath/2007/04/15/strange-loops-de...
- billjings 11y agoHaven't read the article you linked to, but the Brian Kernighan talk it discusses is fantastic, one of my favorite reads in the field: https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thomp...
- vezzy-fnord 11y agoThat's ken, not bwk.
- billjings 11y agoD'oh. Thanks.
- deleted 11y ago[deleted]
- rsc 11y agoYou can start from the C version and move forward and check that you get the same result as starting with released Go binaries. Unless you think Ken somehow backdoored the original C compilers to backdoor every C compiler in the world to backdoor the Go compilers that came about decades later. :-)
- bmir-alum-007 11y agoSeems simpler to just backdoor the linker/library archiver, that way almost all toolchains are backdoored. ;)
- deleted 11y ago[deleted]
- gnuvince 11y agoHow has this affected compile speeds? Go proponents often tout the speed at which it compiles code as an important feature, so I wonder if there's been a noticeable regression.
- dmaz 11y ago> Builds in Go 1.5 will be slower by a factor of about two. https://golang.org/doc/go1.5#performance https://golang.org/doc/go1.5#performance
- deleted 11y ago[deleted]
- chadaustin 11y agoPerhaps things have improved since then, but this thread indicates build times will regress a little: https://groups.google.com/forum/#!msg/golang-dev/6obxRcm-rqc/5k6016u41oEJ https://groups.google.com/forum/#!msg/golang-dev/6obxRcm-rqc...
- sudhirj 11y agoSlower in the short term while the code remains transpiled from C. Will get faster as the team goes over it a couple times.
- rsc 11y agoYes, this is a good summary.
- semiquaver 11y agoThe small increase in build times doesn't bother me at all when I'm generating a binary, but unfortunately it's very noticeable and irritating when using tools like vim-go or syntastic which type-check/lint/gofmt your code. Using these now causes vim to be unresponsive for up to a second every time I save, whereas the delay used to be insignificant.
- mseepgood 11y ago
- vram22 11y ago>This is really cool. Writing a compiler in the language that you're compiling seems kind of meta. It's been done before, for more than one language, IIRC. The technique by which they make an executable of a compiler for language L on platform B, using an existing executable of the same compiler for L on platform A, together with the source code of the compiler for L on A, is also cool. I forget the full details right now. Maybe someone else will pitch in and explain. It's called bootstrapping. It's also related to cross-compiling. Update: Looked it up in Google: https://en.wikipedia.org/wiki/Bootstrapping_(compilers) https://en.wikipedia.org/wiki/Bootstrapping_(compilers) https://en.wikipedia.org/wiki/Cross_compiler https://en.wikipedia.org/wiki/Cross_compiler Also see Canadian Cross under above article - this is like the cool technique I talked about above, but more complex.
- smithkl42 11y agoTypeScript does the same thing - its compiler is written in TypeScript. See https://github.com/Microsoft/TypeScript/tree/master/src/compiler https://github.com/Microsoft/TypeScript/tree/master/src/comp.... But yeah, darned cool, and very meta.
- deleted 11y ago[deleted]
- andrepd 11y agoThe term is self-hosting compiler, when a compiler can compile itself. https://en.wikipedia.org/wiki/Self-hosting https://en.wikipedia.org/wiki/Self-hosting
- tankenmate 11y agoAs the old hacker snark says 'Any language that can't compile itself is a toy language'.
- berfarah 11y agoThis might be a dumb question: What happens if you find a bug in the language? Let's say something that you had written in C was being misinterpreted, and now the go compiler still uses that byte-code to compile new versions of the compiler. Or is that something that isn't really possible?
- jlouis 11y agoI think Russ showed the translated code produces the same binaries as the Go 1.4 C variant. So this isn't very likely given he has the option to pipe roughly any Open Source Go project through the compiler.
- emmab 11y agoYou should read Reflections on Trusting Trust, it expands on this idea in the most beautiful way: https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thomp...
- rcarmo 11y agoIf you use ARM devices, it might be worth pointing out that Dave Cheney has unofficial tarballs of _older_ versions here: http://dave.cheney.net/unofficial-arm-tarballs http://dave.cheney.net/unofficial-arm-tarballs No 1.5 (yet), but if, like me, you do ARM stuff, you might want to bookmark this. And of course the cross-compiler works, but still. (edit: moved mention of ARM to first line)
- coldcode 11y agoStill no real debugger?
- thegeekpirate 11y agohttps://golang.org/doc/gdb https://golang.org/doc/gdb https://github.com/derekparker/delve https://github.com/derekparker/delve
- XorNot 11y agogdb is not a real option at the moment. Being unable to easily parse through maps wipes and slices wipes out most of the actual use cases.
- icedchai 11y agoprintf isn't good enough for you?
- lemevi 11y agoLogging can be of great practical utility, but being able to stop a program and freeze it in its state to figure things out is also pretty nice right. You can walk up and down the stack, inspect the scope and the state of things, walk through line after line of code to try and find things in a way that would take a really long time with logging. So no, printf is not good enough. That's why people have created debuggers.
- enahs-sf 11y agoWhile I can see the argument for and against printf, with the cpu and memory profiling tools, you can basically figure out where most of the issues in your code are. I'd say for most applications, logging, printf, etc. can get you 80% of the way there. Profiling gets you another 10%. For those last mile apps, sorry, but you have to use GDB.
- TillE 11y ago
- hit8run 11y agoCongratulations on the 1.5 release. I already updated my dev machine and everything looks to be still running without errors. Soon my servers will get updates, too! PS: If you want to benefit from 1.5 improvements don't forget to recompile your go programs ;)
- andrewstuart2 11y agoAnd you can recompile in shared object mode if you want tiny programs and shared linking too, though you'll lose the benefit of the single static binary. go install -buildmode=shared std go build -linkshared
- vessenes 11y agoCongrats, this is a huge release. We had some weird corruption of memory issues late in the 1.5RC cycle. It's possible that https://github.com/golang/go/commit/3ae17043f7f29f0d745aa35b340f8cab80219068 https://github.com/golang/go/commit/3ae17043f7f29f0d745aa35b... fixed it, but each test for bisection cost us 4 hours, and the bug didn't always show. (When it did show, it definitely showed without -race mode on, contrary to the comments in the patch) Anyway, if you have a large memory usage highly concurrent go app, I would still tread lightly and carefully with this release; we spent a goodly amount of time blaming our own code before realizing that 1.4.2 did not exhibit the problem.
- rsc 11y agoTo be fair, this is true of pretty much any major release of a new piece of software: tread lightly and test carefully before deploying to production. The new GC, default GOMAXPROCS > 1, and changes to the scheduler may well expose latent bugs in code that worked fine in Go 1.4.
- vessenes 11y agoTotally. We've been mostly running tip for some time, and sending in bug reports when we can be useful, overall a big win for us, but not without its risks. :) Honestly, I could have seen rebranding 1.5 to 2.0; there are major under the hood changes you guys have made.
- rsc 11y agoI can see that, and I've been idly wondering over the past few days what the largest N will be for Go 1.N. The contrast with most version numbering, however, is that we've defined a meaning for Go 2: it breaks all your Go 1 programs. Being a Go 1.X release is actually a stronger statement about how your code will behave.
- andrewchambers 11y agoWaiting for the confusion when Go1 2.0 is released :). Or are you thinking of 1.10?
- 0xdeadbeefbabe 11y agoWas it a joke when one of the core team guys said that he was looking forward to seeing the go compiler in the go standard library? Is the compiler go gettable?
- inlined 11y agoI'm very excited to see Go supported as a library for server and client development on iOS and Android. Are there any good case studies of app developers using Go as a full-stack language?
- cartoonfoxes 11y ago> Are there any good case studies of app developers using Go as a full-stack language? It's been done, but the best use I'm aware of is under NDA.
- kodablah 11y agoSo, who's gonna be the first to blog about compiling a Go lib as c-shared dynamic lib and call it from Rust for serious HN karma? Seriously though, there are several well-written Go libraries for accessing systems that I wonder if the runtime isn't too much baggage to keep the shared libs from being used outside of Go.
- omginternets 11y agoI'm continually surprised at how fast the Go team works.
- gnufrra 11y agoI am glad there is now support for vendor directories, albeit experimental at this stage. https://go-review.googlesource.com/#/c/10923/ https://go-review.googlesource.com/#/c/10923/ Go 1.5 vendor proposal: If there is a source directory d/vendor, then, when compiling a source file within the subtree rooted at d, import "p" is interpreted as import "d/vendor/p" if that exists. When there are multiple possible resolutions, the most specific (longest) path wins. The short form must always be used: no import path can contain “/vendor/” explicitly. Import comments are ignored in vendored packages.
- rem7 11y agoagreed. That's the main reason I'm upgrading.
- XorNot 11y agoIs there any scoping on what vendoring means for forking projects? i.e. if I pull something full of packages like domain.com/user/pkg, would I now be better served just dropping the whole subdirectory tree in a /vendor/ directory?
- mfer 11y agoWe were excited enough we pivoted glide, the package manager, to directly support this new vendor setup. Anyone interested can learn more at https://github.com/Masterminds/glide https://github.com/Masterminds/glide or where I posted about it at http://engineeredweb.com/blog/2015/glide-0.5-go-vendor-support/ http://engineeredweb.com/blog/2015/glide-0.5-go-vendor-suppo.... I'm hopeful for this brave new vendor world.
- Spiritus 11y agoCan't seem to get this to work no matter what I do. And yes, I've set the GO15VENDOREXPERIMENT=1 env variable.
- aikah 11y agoWhat's the state of dynamic linking in go? even with C libs , is it supported ? if yes does it work on Windows ? thx.
- Merovius 11y agoIt is supported. So you can both compile your go packages as a shared object file and link against it and you can compile it into a shared library and load it from C. I have no idea about windows support.
- irq-1 11y agoVery little of what was planned was implemented in 1.5. See the design doc: https://golang.org/s/execmodes https://golang.org/s/execmodes edited summary: - Go code linked into, and called from, a non-Go program In the Go 1.5 release this mode is implemented, using a .a file, for most Unix systems. - Go code as a shared library plugin with a C style API In the Go 1.5 release this mode is implemented for linux-amd64, linux-arm, darwin-amd64, and darwin-arm. When using gccgo it is implemented for any supported target. - Go code as a shared library plugin with a Go style API This is not implemented in the Go 1.5 release. - Go code that uses a shared library plugin This is not implemented in the Go 1.5 release. - Building Go packages as a shared library In the Go 1.5 release this is implemented for the linux-amd64 target only. When using gccgo it is implemented for any supported target. - A Go program built as a PIE This is not implemented in the Go 1.5 release.
- tomp 11y agoStill no user-definable generics? ;)
- andrewchambers 11y agoTrolling is a art.
- tomp 11y agoActually it's a sincere criticism.
- andrewchambers 11y agoWe all know that generics are not coming any time soon. The debate is over, it isn't sincere.
- tomp 11y agoThat doesn't change the fact that the lack of user-defined generics is a valid (and sincere) criticism.
- ericfrederich 11y agolol... Just built 1.4.2 (or whatever latest 1.4 was) last night. I was wondering whether or not to go against master. I wonder if there were even any commits since then or just a tag.
- fitzwatermellow 11y agoKudos to the Golang team and its many contributors. The reduction in latency with concurrent GC is a massive step forward. I wouldn't be surprised to see Golang gain significant traction in the research and HPC communities in the near future. Also glad to see wide adoption in Chinese consumer internet running at gargantuan scale: Tencent, WeChat, Didi Kuaidi and many more. Are you guys at all surprised to see it take off on the mainland?
- mattetti 11y agoWe updated Splice's CI to 1.5 and rolled out our code to prod. The total GC pause time improvement is quite drastic for us: https://twitter.com/mattetti/status/634114976362291200 https://twitter.com/mattetti/status/634114976362291200 Throughput hasn't changed and average performance is about the same for us (slightly faster actually)
- stock_toaster 11y agoSounds like netgo is the default now? That is great -- no more having to remind people to use `-tags netgo`!
- anonfunction 11y agoHappy to see Travis-CI updated gimme[1] with 1.5 support just now! I've been anticipating the change and had already updated my .travis.yml file in my stats package[2] which would fall back to tip. [1] https://github.com/travis-ci/gimme/issues/19 https://github.com/travis-ci/gimme/issues/19 [2] https://github.com/montanaflynn/stats https://github.com/montanaflynn/stats
- ecigjuice 11y agoWow still no generics even after so many people asking for them
- SarahofGaia 11y agoI'm still a beginner with code. I've been learning HTML (not yet CSS, as far as I know) and Markdown, and I'm also in the middle of learning Python using free courses on Udacity. This is all in my free time. No courses taken. Would this be a good language to learn right now, or would I be better off waiting till I'm more experienced?