10 ms·
Go 1.7 is released
- geodel 10y agoSeems like a great release. Faster compilation and faster at runtime. Normally these 2 are considered opposite of each other.
- oxplot 10y agoAnd smaller binary size too. For a statically linked blob, that's a big plus.
- cm3 10y agoBTW, what does one have to do to get fully statically linked executables? The binaries I've created with go get SOMETHING are linking against libc, but I remember that go doesn't rely on the system libc. Has that changed? For instance I just installed git-appraise, and it's a dynamically linked executable. What am I doing wrong?
- zbobet2012 10y agoCGO_ENABLED=0 Otherwise it will dynamically link glibc in case of CGO code. Note: the race detector does not work without cgo enabled.
- Scaevolus 10y agoGo generally links to libc to use the system's getaddrinfo-- some OSes override it to do special things with dynamically discovered hosts on local networks, interfacing with LDAP/AD, etc. If you use `CGO_ENABLED=0 go build`, it should make a statically linked executable.
- voltagex_ 10y agoBy some OSes, you mean any Linux distro with Avahi installed, right? I'm assuming getaddrinfo checks NSS for where to look up hostnames. I should also check how Windows with Bonjour behaves.
- kyrra 10y agoI don't believe that has been true for a few releases now. I believe go defaults to a pure Go resolver implementation now. You have to force enable the cgo resolver. https://golang.org/pkg/net/ https://golang.org/pkg/net/
- f2f 10y agofrom the same page: "When cgo is available, the cgo-based resolver is used instead under a variety of conditions: on systems that do not let programs make direct DNS requests (OS X), when the LOCALDOMAIN environment variable is present (even if empty), when the RES_OPTIONS or HOSTALIASES environment variable is non-empty, when the ASR_CONFIG environment variable is non-empty (OpenBSD only), when /etc/resolv.conf or /etc/nsswitch.conf specify the use of features that the Go resolver does not implement, and when the name being looked up ends in .local or is an mDNS name."
- loosescrews 10y agoIt is probably the net package. The net package depends on cgo and libc for some DNS resolution. There is a pure Go implementation, but the cgo one is used if cgo is available. If you disable cgo as the other comments say, the pure Go implementation will be used instead. Alternatively, you can not include the net package. Search for systemConf().canUseCgo() https://github.com/golang/go/blob/master/src/net/lookup_unix.go https://github.com/golang/go/blob/master/src/net/lookup_unix...
- chrj 10y agoMost likely it depends on the `net` package which can use `getaddrinfo` for dns lookups. Try using the `netgo` build tag: go install -tags=netgo github.com/google/git-appraise/git-appraise
- cm3 10y agoI tried that and also env CGO_ENABLED=0 go get github.com/google/git-appraise/git-appraise but I always get an error that go wants to write net.a in /usr/lib, which I naturally am not allowed to do because it's owned by the distro (Arch) go package: go install net: open /usr/lib/go/pkg/linux_amd64/net.a: permission denied I have only set GOPATH to ~/.go and nothing else. Any other GO environment variable I should have used?
- chrj 10y agoGo needs to re-build the stdlib packages with the new build tag as well. You could install go locally somewhere in ~ and point GOROOT there.
- yiyus 10y agoAfter the transition from C to Go of the gc toolchain there was a lot of potential in both areas. The SSA backend increased even more that potential. And there is still room for improvement, so future versions will be even better. But yes, it's a great release. Congrats to the team!
- deleted 10y ago[deleted]
- sdegutis 10y agoCool. What's the plan for Go 8? What exciting features are up ahead?
- bradfitz 10y agoSSA for all architectures, then delete the old compiler backend and optimize the frontend which can then assume an SSA backend and do less work. (Currently the frontend assumes a less-capable backend so has to do more work, which actually makes SSA slower)
- nathany 10y agoYou can read through this thread to see what people want to work on for Go 1.8. https://groups.google.com/forum/#!topic/golang-dev/098vr4999Tk https://groups.google.com/forum/#!topic/golang-dev/098vr4999...
- travjones 10y agoGreat work, Go team! Standout points in my opinion: Overall performance improvements: >> "We observed a 5–35% speedup across our benchmarks." Decreased compile times and binary size: >> "While these changes across the compiler toolchain are mostly invisible, users have observed a significant speedup in compile time and a reduction in binary size by as much as 20–30%." Vendoring dependencies by default: >> "...and in Go 1.7... the "vendor" behavior is always enabled" Context package added to std lib: >> "To make use of contexts within the standard library and to encourage more extensive use, the package has been moved from the x/net repository to the standard library as the context package."
- mattetti 10y agoThe faster compilation time & speed up is quite real in our real life prod application. From Go 1.6 to 1.7: Test suite (CI), from 3:34 to 1:48 Docker image building, from 3:05 to 1:50 https://twitter.com/mattetti/status/763913903600349184 https://twitter.com/mattetti/status/763913903600349184
- sfrailsdev 10y agovendor directories are no longer optional, which is nice. Go get now update submodules... I'm honestly not sure what the current hack is for package management, but I assume people are still doing wrappers around go get to pin to commits/versions, (or else building your own repos for funsies), and I'm wondering if that breaks anything.
- owaislone 10y agoHopefully we'll have something official soon. For now, glide has been working well for us.
- nathany 10y agoThere are active discussions on the Go Package Management mailing list and the intention to propose further improvements to the go toolchain for future releases. We had good discussions with the Go Team during GopherCon last month. https://groups.google.com/forum/#!forum/go-package-management https://groups.google.com/forum/#!forum/go-package-managemen...
- Cidan 10y agoTo be clear, vendor directories are still optional to use, you just don't have to enable them by default. We use a unirepo for all of our Go work, and being forced to use the vendor directory would be a massive headache.
- sfrailsdev 10y agoMy understanding is that there is no longer an option to disable them as a feature as there was in 1.6, though of course you don't have to use them.
- nathany 10y agoYup, and you can always rename vendor/ to _vendor/ if you want to ignore them temporarily.
- stock_toaster 10y agoBe sure to check out the release notes, especially if you run FreeBSD (see known issues section). https://golang.org/doc/go1.7 https://golang.org/doc/go1.7
- bradfitz 10y agoFWIW, this isn't a new regression on FreeBSD. We also saw these problems on Go 1.6 once we looked at our old build logs. It's just now documented.
- deleted 10y ago[deleted]
- maxpert 10y agoAwesome! Time to recompile RaspChat :D
- chrisper 10y agoI just learned Go 2 days ago and today I am already running my own web app! I love Go because it is kind of like C, but better (more modern).Generally, I always program my stuff in Java, but whenever I have an idea of creating something I could only choose between: C, Java, bash. Obviously I am not going to use C and bash for most of my ideas. Thinking about solving my issues in Java is meh so often I decided it is not worth it to invest time. I feel like using Java for my ideas is like using a semi truck for roadtrips. It can be done, but it's just not very efficient having to launch the JVM everytime I want to do something small. Yes, I was open to new languages, but I did not really care about: C++, Python, Perl, Ruby and so on because I never cared about web dev. Now I was bored and finally decided to learn Go.
- ufmace 10y agoI suggest giving Ruby a try too. I find it great for both web dev and local automation scripts. You can do pretty much anything you can do in bash but with clearer and shorter code. I've been writing all my non-trivial automation code in Ruby for years. Rails is just a popular web framework for Ruby, there's a lot more the language can do.
- jsmith0295 10y agoI'd second this. Rails is still probably the fastest way to get an MVP off the ground, and most of the time it's more than fast enough. You can get UX on par with a well done SPA almost entirely using server code with Turbolinks 5 + Action Cable, too.
- kowdermeister 10y agoThe fastest way to get an MVP off the ground is to use the tools you know best. It doesn't have to be Rails :)
- jsmith0295 10y agoYes, this is also usually true. But if you don't know tools that are particularly well suited for the job, or you just don't like them and are looking for something else to try, I would put Rails at the top of the list for productivity. (For most use cases)
- ksec 10y agoOk, off topic question. Not an expert in grammar, but something about "Go 1.7 is released" seems wrong to me. Anyone could tell me if this is an correct usage of grammar? Edit: Dont know why so many downvote, but it is a honest question.
- collinvandyck76 10y agoWhat about it seems wrong to you?
- andrewchambers 10y agoMaybe "Go 1.7 has been released" or "Go 1.7 is out"
- ksec 10y agoExactly, both would have been a fine. I am wondering if this is a grammar mistake, or general English usage difference in US and Commonwealth countries.
- deleted 10y ago[deleted]
- scriptdevil 10y agoI am not a native English speaker myself. But yes that fragment while correct parsed a bit weirdly in my head because "is" is often used for properties of an entity like "John is dead" and "has been" is often used for something that is done to something. Like "John has been convicted". I think it has something to do with "is" being a simple present form while "released" in one sense talks about the state of the object in which case it is fine but also in another case is the action of getting released in which case it is in the simple past tense.
- jimjimjim 10y agoI'm happy as long as no one tries to say "Go 1.7 has dropped".
- 10y ago
- Tehnix 10y ago>A new compiler back end, based on static single-assignment form (SSA), has been under development for the past year Huh, I was under the impression that either SSA or CPS was pretty standard for any serious compiler. Does anyone know why they didn't design it for this from the beginning? It's like one of the earlier things you learn when making actual compilers.
- pcwalton 10y ago> Huh, I was under the impression that either SSA or CPS was pretty standard for any serious compiler. It was based on the Plan 9 compilers, which didn't use SSA.
- enneff 10y agoIt was more expedient to start with the Plan 9 tool chain that we had at the time. Ken was already familiar with the code base, which was small and compiled quickly (a few seconds). Because of this we got a lot done quickly, knowing that we would eventually modernize the compiler.
- thomasahle 10y agoHow much is Ken involved in the language today?
- bradfitz 10y agoKen is not really involved in the project these days. His last commit was in 2011, before Go 1 was even released.
- nathany 10y ago(afaik) He retired around the Go 1.0 release, though he showed up as unixken on reddit during a Go Ask Me Anything. https://www.reddit.com/r/golang/comments/46bd5h/ama_we_are_the_go_contributors_ask_us_anything/d03sbfu https://www.reddit.com/r/golang/comments/46bd5h/ama_we_are_t...
- UniQP 10y ago
- cyphar 10y agoThe one thing that really pisses me off about the way Go handled vendoring is that they did it in a way that makes it incompatible with GOPATH. Previously in runC and Docker, we had build hacks that would symlink (or full copy) the current directory into vendor/src/<package> and then set the GOPATH to vendor/. This was compatible with every go version. In addition, many other projects did the exact same thing. But the way that vendoring works in Go 1.5 and up is that you make vendor not a valid GOPATH and you have to now either create a fake GOPATH and move your current directory into it, or you have to do some symlink stuff within vendor/ that doesn't really work. Why was such a small cosmetic change seen as a good idea? It's needlessly incompatible with previous ways of making vendoring work seamlessly with Go. I'm hoping that the packaging discussions that are going to be happening over the next few months don't result in a similar decision that "we know best".
- hacknat 10y agoI just wish they would add tagging support.
- zzzcpan 10y ago> I'm hoping that the packaging discussions that are going to be happening over the next few months don't result in a similar decision that "we know best". Judging by current packaging discussions, I don't see it happening any other way. I just hope they don't mess things up too much.
- lobster_johnson 10y agoIf anything, the Go people have repeatedly claimed they don't know best -- because Google famously uses a huge monorepo with all deps vendored, and don't do "package management" as such -- and have preferred to let the community find a solution organically. Which is also why we ended up in this frustrating profusion of competing tools (Godeps, Glide and many others, plus the messy business that is git submodules) rather than a concerted effort towards a unified solution. I don't at all believe the argument that they can't design something because they don't need it at Google. They're engineers, after all. You don't need to use a bridge in order to build one. There are plenty of existing tools (Bundler, Cargo, NPM, Cabal) that can also be used as case studies in how to do things right (Bundler, Cargo) or don't do them wrong (NPM). In my company we use Glide, which is the best solution I've encountered so far, but it's beyond buggy, and struggles with some Google repos that need to be flattened in order to avoid duplicate, conflicting dependencies (glog and pflags, sigh).
- cyphar 10y agoYay, s390x support is finally in mainline! Finally we (SUSE) no longer needs to use gcc-go to build Go binaries on some platforms (we've had nothing but issues from gcc-go, half of the patches we apply to Docker are to make it behave when built with SLE's gcc version).
- aprdm 10y agoI have some years of experience with python and picking up golang was extremely straightforward. Sometimes it annoys me a little bit because it's standard lib is much smaller than python's however having it being compiled is more than worth it. Thanks go team !
- bberrry 10y agoThat's been my feeling for a long time now. After getting spoiled by Pythons enormous standard library, other languages feel incredibly bare-bones and getting things done takes a lot more work. I wish other languages focused more on including lots of library functions.
- krylon 10y agoSize alone is only half (at best) of the equation. What makes Python's standard library stand out is the way it is structured and documented. Consider Java's standard library, which is huge. That last few times I did anything in Java, I spent more time browsing the library documentation than coding. Admittedly, I did not know the library very well, if one uses Java all the time, that ratio probably changes. In Python I don't need to know the standard library well, because the way the documentation is written makes it very easy to find what I am looking for.
- blinkingled 10y agohttps://github.com/golang/go/commit/a62ae9f62fcfca02075b70e6e0aa757f4fd8f5ec https://github.com/golang/go/commit/a62ae9f62fcfca02075b70e6... > SystemCertPool returns an error on Windows. Maybe it's fixable later This doesn't inspire confidence in Go as a cross platform language which is at version 1.7. If this is implemented in say 1.8, am I supposed to check for Go versions in order to know if the SystemCertPool func works or not? I mean why not just release it when it works on all tier-1 supported platforms?
- krasin 10y ago>If this is implemented in say 1.8, am I supposed to check for Go versions in order to know if the SystemCertPool func works or not? No, not really. Just compile the program with 1.8, and don't worry about the bugs in the past.
- IshKebab 10y agoGo is far better than most languages at supporting random system APIs. I mean, you can cross-compile code on Windows that uses Linux syscalls. Try doing that in Python. Actually I just Googled and I'm not sure Python even lets you use syscalls. I also couldn't even find any third party library to give you the system CA pool, let alone a first party one. Tell me a language that has a first-party cross-platform library that allows you to get the system CA pool on all platforms.
- wbond 10y agoMy third-party Python library that gives access to the system CA trust store: https://github.com/wbond/oscrypto https://github.com/wbond/oscrypto
- bradfitz 10y agoThanks for the reminder. I've filed: https://github.com/golang/go/issues/16736 https://github.com/golang/go/issues/16736 We actually try hard not to do platform-specific stuff, but in this case it seemed worth it, considering the problems people were having with cert validations and how Windows differs in how it validates TLS connections.
- yuyuyy 10y agoIs Go based on llvm? It doesn't seem like it, but would be curious to know why not? Isn't this the point of llvm, to separate the "language component" from the "cpu component"?
- niftich 10y agoIt's not based on LLVM. I don't know how recently the official FAQ was updated, but they say [1] that while they thought about using LLVM, they thought it was too large and slow for what they were looking for. [1] https://golang.org/doc/faq#What_compiler_technology_is_used_to_build_the_compilers https://golang.org/doc/faq#What_compiler_technology_is_used_...
- micro_cam 10y agoThere are llvm (and gcc) implementations of go but main/reference implementation was written from scratch in C and later moved to pure go. IIRC the authors wanted to achieve really fast compilation and a few other things that required them to start from scratch.
- nathany 10y agoThere was also the matter of figuring out llvm in order to use it. The initial Go compiler was based on the Plan 9 C compiler toolchain, which the designers of Go know well. One of the other reasons relates to how stacks are handled for goroutines.
- neilc 10y agoThis comment from one of the Go maintainers (Russ Cox) is relevant: https://news.ycombinator.com/item?id=8817990 https://news.ycombinator.com/item?id=8817990
- pjmlp 10y agoOne benefit is that they were able to bootstrap the language and now enjoy having a pure Go toolchain. Whereas with LLVM, while they could benefit from all the work that has gone into it, they would get a dependency on C++ for life. This way, the progress is slower and multiple releases will be required to achieve some optimizations, on the other hand it is the only way to prove to naysayers that for the systems programming use case of writing compilers, Go is also a viable option.
- WhitneyLand 10y agoElevator description: - Open source, 6 years old, backing from Google - Nice for concurrency and service implementations - Not nice for generic types - C like, modern, minimalist, garbage collected - Becoming more popular
- litaohackernews 10y agoThe semantics of Go is too ugly. It has no taste.
- spriggan3 10y agoIt's also a necessary "evil" to demonstrate that languages should have the right amount of features, no more and tools are part of a language, along with ease of deployment. It's is questionable whether Go strikes the right balance when it comes to features vs "simplicity" though, but it might inspire better solutions in the future. I think MSFT is trying to follow the same path with .net core and its tool chain, I hope they succeed as C# and F# are vastly superior to Go.
- mixedCase 10y ago>I hope they succeed as C# and F# are vastly superior to Go. In number of features, yes. Everything else and you come off as opinionated. I cannot comfortably write C# from my Linux workstation since all the tools are Windows-first. C# is a language where everything must be done in classes and inherits a C++/Java school of OOP which I find abhorrent as it tends to favor monstrosities of abstraction upon abstraction. I can almost always read a Go codebase and get a good general sense of what it's doing in a few minutes, I can't say the same about C# codebases, and I have worked with C# for around the same time I've worked with Go. These things aren't clear cut for everyone the same way.
- lobster_johnson 10y agoC# in VSCode is really good, and works on Linux. Have you tried it?
- PopsiclePete 10y agoI wrote C# professionally for 7 years. IMO, it's in almost way inferior to Go: * requires a separate and quite heavy run-time * still too windows-centric * Enforces a class-based OOP style * Functional programming elements feel very tacked-on * Feels heavier, slower, more bureaucratic * The async/await Task-based concurrency features are still not as flexible as Go's concurrency. I find Go much more light-weight, easer to get into, enjoyable, and fun. So, how exactly is C# "vastly superior" to Go?
- tmaly 10y agoGreat work, I am looking forward to recompiling my code to see how things are. I have had my side project running on a set of Go micro services compiled against 1.4 since last year. What can we expect from Go 1.8?
- nathany 10y agoYou can read through this thread to see what people want to work on for Go 1.8. https://groups.google.com/forum/#!topic/golang-dev/098vr4999Tk https://groups.google.com/forum/#!topic/golang-dev/098vr4999...
- jcadam 10y agoI wish the Clojure compiler was half as fast as Go's :( I'm not much of a fan of using Go for anything 'big', but I have taken to using it in places where I would have previously used Python (tiny/simple services, housekeeping/utility scripts fired by cron, etc.) I'd love to use Go at work (amongst many other things), but my employer already gives me a hard time for writing small utilities in Python rather than Java (I refuse to wait for a JVM to spin up just to convert a single file from csv to xml. I simply will not do it, and apparently my employer doesn't consider it worth firing me over).
- infinotize 10y agoWhat makes you choose Go over Python for simple services and utility scripts? (I'm just learning Go but would heavily lean towards Python for those things)
- jcadam 10y agoOff the top of my head: - Ease of deployment. It's a standalone binary - I don't have to ensure python and all needed libraries are installed/configured. - I like Go's standard library - it usually has everything I need to whip up a basic network service easily. - Better/easier concurrency support. - It's faster than Python (though that's usually not incredibly important most of the time).
- zigzigzag 10y agoSpinup of the JVM is 50 msec or so, for a hello world. Perhaps it's been a while since you tried running a small program on it? I can see why you might think the JVM starts slowly if you only ever run huge programs on it.
- nilso 10y agoNice work