Slashdot Mirror


Go Version 1 Released

New submitter smwny writes "Google's system programming language, Go, has just reached the 1.0 milestone. From the announcement: 'Go 1 is the first release of Go that is available in supported binary distributions. They are available for Linux, FreeBSD, Mac OS X and, we are thrilled to announce, Windows. ... Go 1 introduces changes to the language (such as new types for Unicode characters and errors) and the standard library (such as the new time package and renamings in the strconv package). Also, the package hierarchy has been rearranged to group related items together, such as moving the networking facilities, for instance the rpc package, into subdirectories of net. A complete list of changes is documented in the Go 1 release notes. That document is an essential reference for programmers migrating code from earlier versions of Go. ... A similar process of revision and stabilization has been applied to the App Engine libraries, providing a base for developers to build programs for App Engine that will run for years.'"

41 of 186 comments (clear)

  1. Go is already being used by CondeZer0 · · Score: 4, Interesting

    The amazing thing is that even before the first stable release is out quite a few organizations are using Go in production to run real systems. Very impressive:

    http://go-lang.cat-v.org/organizations-using-go

    --
    "When in doubt, use brute force." Ken Thompson
    1. Re:Go is already being used by vAltyR · · Score: 2

      Don't forget vitess, which is a Google project aimed at making MySQL databases scale better, and is used in YouTube. The Thanksgiving Google Doodle was also written in Go, and developed in 24 hours. Google does eat their own dogfood.

    2. Re:Go is already being used by Eraesr · · Score: 2

      What a nonsense statement. The systems that run on Go are equally important to these companies as Google's server farms are important to Google. Just because they aren't multinational super corporations doesn't mean it's not a risk for them to use a relatively unproven development platform.

  2. Added value of Go? by billcarson · · Score: 5, Interesting

    Can someone explain to me what Go's aim is, and why exactly it requires a new programming language? Is it meant a replacement for Java/C++/Python, or does it cater a new branch of programming?

    1. Re:Added value of Go? by cgt · · Score: 5, Informative

      It is supposed to be a systems language like C, but better. It's sort of like Pythonic C (very expressive, but still C like).

    2. Re:Added value of Go? by Quirkz · · Score: 2

      In addition, if I'm a hobbyist programmer who's gotten by on PHP and some JavaScript for web stuff over the last decade and a half, and I'm thinking about picking up something new, should I consider Go or stick with one of the older standards?

    3. Re:Added value of Go? by Urban+Garlic · · Score: 4, Interesting

      Maybe I'm too old-school, but when I think "systems language", I think about something that would be good for embedded devices or kernel device drivers, stuff that's pretty close to the metal. I wouldn't use Go for that, garbage-collection and concurrency mean there's heap traffic and IPC signaling under the hood that I probably want to control.

      I agree with the "C but better" characterization, but the ways in which it's better disqualify it from being a good systems tool, I think.

      --
      2*3*3*3*3*11*251
    4. Re:Added value of Go? by PCM2 · · Score: 4, Informative

      Maybe I'm too old-school, but when I think "systems language", I think about something that would be good for embedded devices or kernel device drivers, stuff that's pretty close to the metal. I wouldn't use Go for that, garbage-collection and concurrency mean there's heap traffic and IPC signaling under the hood that I probably want to control.

      Java is used in a lot of embedded systems, and it has garbage collection and concurrency.

      Unlike Java, though, Go compiles to native binaries, rather than running on a VM (though maybe the real difference is debatable with modern JITs).

      --
      Breakfast served all day!
    5. Re:Added value of Go? by aardvarkjoe · · Score: 2

      I spent a little time playing around with it a few months ago. It had its good points and bad points -- enough of the latter that I didn't pursue it any further.

      The syntax is obviously C-inspired, but with some changes, many of which seemed like experimentation -- doing something different just because it's different. Although I don't object to the philosophy, I'd like to see how those changes work out before investing a lot of time into them. In particular, the declaration syntax feels very strange to people who are used to C-style languages. There are also some contortions due to their desire to remove statement-ending semicolons; I wasn't convinced that the savings of not typing ';' was worth the cost.

      You get a systems-level language that includes complex data structures, garbage collection, and various other nice features. The standard libraries are useful and fairly comprehensive, although I found several times that documentation, even for built-in libraries, is frequently outdated, insufficient, or nonexistent.

      --

      How can we continue to believe in a just universe and freedom to eat crackers if we have no ale?
    6. Re:Added value of Go? by Anonymous Coward · · Score: 3, Insightful

      I would stay away from Go and pick up Python. It has lots of good libraries and frameworks. Its used in some games and lots of open source projects as their scripting language. Python is a very expressive and general purpose language. It does not appear to be going away within the next decade and in fact I expect Python to become much more prevelent once PyPy becomes more robust. Added to all that, extending Python with commonly available libraries is not a difficult task and there are numerous approaches (each with varying pros and cons) for doing so.

    7. Re:Added value of Go? by Raenex · · Score: 3, Informative
      http://golang.org/doc/go_faq.html

      What is the purpose of the project?

      No major systems language has emerged in over a decade, but over that time the computing landscape has changed tremendously. There are several trends:

      • Computers are enormously quicker but software development is not faster.
      • Dependency management is a big part of software development today but the “header files” of languages in the C tradition are antithetical to clean dependency analysis—and fast compilation.
      • There is a growing rebellion against cumbersome type systems like those of Java and C++, pushing people towards dynamically typed languages such as Python and JavaScript.
      • Some fundamental concepts such as garbage collection and parallel computation are not well supported by popular systems languages.
      • The emergence of multicore computers has generated worry and confusion.

      We believe it's worth trying again with a new language, a concurrent, garbage-collected language with fast compilation. Regarding the points above:

      • It is possible to compile a large Go program in a few seconds on a single computer.
      • Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
      • Go's type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types the language attempts to make types feel lighter weight than in typical OO languages.
      • Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
      • By its design, Go proposes an approach for the construction of system software on multicore machines.
    8. Re:Added value of Go? by GreatBunzinni · · Score: 5, Insightful

      It is supposed to be a systems language like C, but better.

      IMHO, if it isn't standardized, opened up and backed up by an international standard then it will never be better than C. For all problems that may or may not affect C and for all problems involved in the development and update of a standard for each version of the C programming language, these multiple versions of the C programming language are effectively set in stone. This means that the language is future-proof, as multiple implementations may be developed and, by targetting the standard, they can interoperate without any major consequence.

      If Go isn't standardized and if Google intends to control the language then it would be a terrible decision to adopt Go instead of a time-tested, well established tool which is future-proof and resistent to bit-rot. We all have Oracle and Java as a good warning.

      --
      Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
    9. Re:Added value of Go? by Spykk · · Score: 2, Interesting
      I tried grabbing go and compiled a hello world to compare it to C:

      [talisman@talisman-pc:~/tmp]$ uname -a
      Linux talisman-pc 3.2.13-1-ARCH #1 SMP PREEMPT Sat Mar 24 09:10:39 CET 2012 x86_64 AMD Athlon(tm) II X4 640 Processor AuthenticAMD GNU/Linux
      [talisman@talisman-pc:~/tmp]$ cat test.go
      package main

      import "fmt"

      func main() {
      fmt.Println("Hello, world")
      }
      [talisman@talisman-pc:~/tmp]$ time go build test.go

      real 0m2.215s
      user 0m2.547s
      sys 0m0.210s
      [talisman@talisman-pc:~/tmp]$ ls -lh test
      -rwxr-xr-x 1 talisman talisman 1.3M Mar 28 15:43 test
      [talisman@talisman-pc:~/tmp]$ time ./test
      Hello, world

      real 0m0.003s
      user 0m0.000s
      sys 0m0.000s
      [talisman@talisman-pc:~/tmp]$ cat test.c
      #include <stdio.h>

      int main(int argc, char **argv) {
      printf("Hello, World!");
      return 0;
      }
      [talisman@talisman-pc:~/tmp]$ time gcc test.c

      real 0m0.047s
      user 0m0.027s
      sys 0m0.013s
      [talisman@talisman-pc:~/tmp]$ ls -lh a.out
      -rwxr-xr-x 1 talisman talisman 6.6K Mar 28 15:45 a.out
      [talisman@talisman-pc:~/tmp]$ time ./a.out
      Hello, World!
      real 0m0.001s
      user 0m0.000s
      sys 0m0.000s
      [talisman@talisman-pc:~/tmp]$

      This is obviously not a very scientific comparison, but the takeaways are that the go executable was 1.3M compared to the C executables 6.6K and the go compile took over 2 seconds whereas the C compile took less than 0.05 seconds.

    10. Re:Added value of Go? by shutdown+-p+now · · Score: 2

      I don't know whether Java is poorly suited to embedded environments

      It is. I mean, it's a language that doesn't have stack-allocated user-defined types or arrays or primitive types - how's that for embedded?

      The fact that not only was it pushed for that role, but enough people actually bought into it, tells you all you need to know about the average IQ of homo sapiens.

    11. Re:Added value of Go? by Lemming+Mark · · Score: 2

      Embedded has become a rather broad space these days as the range of computing hardware that's built into other devices gets more powerful at the high end.

      Like the GP I think I'd usually prefer to think of a "systems language" as something that's suitable for kernel programming and for the low cost / simple CPU end of embedded work, where things can still be very highly resource constrained. But I can see why they're calling Go one, since I'd also expect a "systems language" to be suitable for writing OS utilities, servers, databases, etc - which Go probably is indeed suited to.

      I do still hope we'll one day see a favoured C replacement emerge - one that has similar characteristics and abilities but which is nicer to code in. Not that C is bad at what it does - for the sorts of tasks it's good at it's still really quite good...

  3. Go has some good ideas by larry+bagina · · Score: 2

    but mandating their terrible indent style is not one of them.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

    1. Re:Go has some good ideas by Cenuij · · Score: 4, Insightful

      The style, or your preference for a particular style, is not important in the least. What's important is the consistency. Really... *nobody* cares what style *you* prefer.

      --
      my other sig is written in brainfuck ;)
    2. Re:Go has some good ideas by cgt · · Score: 2

      I completely agree with this. I love Go! It is the most excited I have been about a programming language since Python, but the semi-colon issue is stupid. Why do automatic insertion of semi-colons if it causes problems? Why not just let developers insert the semi-colons themselves? Programmers have done so for decades so it probably won't kill them. Do it right or don't do it at all (automatic semi-colon insertion).

    3. Re:Go has some good ideas by bill_mcgonigle · · Score: 2

      Really... *nobody* cares what style *you* prefer.

      The most important person who cares what style he prefers is him. Really, that's all that matters.

      It's a silly reason to drive people away from your language. I'm sure a smart preprocessor could deal with many indent styles just fine, but what's scary is when the language developers say, "here is how you will use our language." Because other people always find more clever things to do with flexible languages than the designers intended. That's just being humble.

      --
      My God, it's Full of Source!
      OUTSIDE_IP=$(dig +short my.ip @outsideip.net)
    4. Re:Go has some good ideas by mounthood · · Score: 2

      The style, or your preference for a particular style, is not important in the least. What's important is the consistency. Really... *nobody* cares what style *you* prefer.

      Go has "gofmt" which reformats code to a sensible standard and is also used by editors, so basically all code in Go is formatted consistently. There really isn't any discussion on formatting; everyone has taken the attitude of 'whatever gofmt does is fine, and that's the standard we'll use.'

      --
      tomorrow who's gonna fuss
  4. Re:Wake me by buchner.johannes · · Score: 2

    What's the point in that? Go is very expressive. Just write in Go instead of Python.

    Yes, because all libraries in the world are already written in Go and everything is better in Go than in any other language in the world. You must only work on trivial problems if you don't need other packages / shoulders of giants.

    --
    NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
  5. Beard? by ch-chuck · · Score: 2

    Do the developers of GO have beards?

    --
    try { do() || do_not(); } catch (JediException err) { yoda(err); }
  6. Re:Wake me by Cenuij · · Score: 2

    So write in Go and import the C libs.

    --
    my other sig is written in brainfuck ;)
  7. Re:Wake me by Ibiwan · · Score: 4, Insightful

    So do good ones.

    --
    -- //no comment
  8. Re:Wake me by amck · · Score: 4, Insightful

    The GP referred to Fortran and C as well as python.

    Increasingly we're seeing lots of legacy code (C / C++ / Fortran) wrapped in Python. People using Python for simplicity and expressiveness, dropping to C , etc. for the heavy lifting. This is especially true in the sciences (in HPC, for example).

    Trying to avoid the language flamewar, there are distinct advantages in a small number of interoperable languages like this.
    If I'm to try a new language, I want to avoid having to rewrite the world in it. I might convince my colleagues to use my code if they can interop. from the language they are already using, like C/C++ or Python.

    --
    Anyone who believes exponential growth can go on forever in a finite world is either a madman or an economist
  9. Another new langauge? by Dwedit · · Score: 2

    How does this language compare with Mozilla's new programming language?

  10. Time to Give Go Another Look by inglorion_on_the_net · · Score: 2

    First time I looked at Go, my conclusion was "this language isn't ready". The next time I looked at Go, I concluded that it had essentially bled to death. But the release of version 1 changes things. I will take another look. I hope they've worked out enough of the details for me to be able to tell if this is a language I would love to work with or not.

    --
    Please correct me if I got my facts wrong.
    1. Re:Time to Give Go Another Look by iplayfast · · Score: 2

      The semicolon at the end of the line thing decided me that it was a toy language. That the meaning of the statement(s) change if the semicolon is on a new-line or on the same line.

  11. Re:Rube Googleberg Machines? by Cenuij · · Score: 5, Informative

    I don't think you fully grok what they have achieved. Google employs only a handful of people who work on Go, and probably not all them work full time on it (though maybe that's not true lately in the last release cycle).Let me give you a quote from an accomplished (hint, you use his code every day) C & C++ hacker on using Go:

    "In my experience Go is probably 5-10x faster than C or C++. I estimate that programs that take me half an hour to write in Go would take me about 2½ hours in C and 5 hours in C++."

    Then when you only have to wait about 10 seconds or so for the whole Go std library *and* all your own libs and binaries to build, you can see it's value over waiting for large C++ projects (of which Google has many) to build.

    --
    my other sig is written in brainfuck ;)
  12. Re:nothing to see here... by tibit · · Score: 2

    I don't see how C is elegant. It's a horrible pain to write a lot of modern code from across many disciplines in C and even C++. Most software that deals with hardware or UIs needs to process asynchronous events and producers/consumers, so you need state machines and yield at the very least. Those are almost universally a royal pain to hack around. Just look at the statechart and msm libraries in boost -- and that's C++, not C! In plain C, look at Miro Samek's QP framework. Both C and C++ gets you to drown in irrelevant syntax for anything but old style procedural code, never mind that those languages artificially hide introspective data -- for example, there's no generic way in C nor C++ to add structural information about instances to enable non-conservative garbage collection. Go is a step in the right direction at least, even if it offers no compile-time computation (I consider that a must in any modern language).

    --
    A successful API design takes a mixture of software design and pedagogy.
  13. Re:does Google even use it? by K.+S.+Kyosuke · · Score: 2

    Last time I checked Googlers were limited to C++, Java, JS, and Python.

    If you check now, you'll find out that the list is C++, Java, JS, Python and Go. In future, it may even be just C++, Java, JS and Go, judging from the trend at Google. (Specialties like Sawzall don't count here, I guess.)

    --
    Ezekiel 23:20
  14. Re:Pi is wrong on the main site by rgbrenner · · Score: 3, Interesting

    This is interesting... If you run the Concurrent Pi example program on the Go website.. it prints:

    3.1417926135957908

    But it should be:

    3.1415926535897932

    It's wrong starting with the 5th digit...

    What kind of language is that inaccurate? And why would they use it as an example program?!

  15. new Rune data type by bames53 · · Score: 3, Insightful

    I see language designers are still making the mistake of trying to represent characters as fixed size entities. Go 1 adds a new data type 'rune' intended to represent a UTF-32 codepoint, which is fine as long as it's only used for code points, but then the example code they show is:

            delta := '' // delta has type rune.
            var DELTA rune
            DELTA = unicode.ToUpper(delta)

    When you design an API that accepts or returns individual characters (as opposed to code units or code points), do not use rune, char, wchar_t, char16_t, char32_t, int, or any other fixed length type to represent a character. Characters are fundamentally variable length.

    You should use a string data type because fixed size types can only represent a subset of characters. For example, a single UTF-32 code point cannot represent the Lithuanian characte LATIN SMALL LETTER A WITH OGONEK AND ACUTE. In Unicode this character can only be represented as a sequence of multiple code points (<U+0105> <U+0301> or <U+00E1> <U+0328> or <U+0061> <U+0328> <U+301>). So using strings works whereas using a fixed size type will inevitably fail.

    Using strings to represent a character has another advantage beyond the fact that it's the only way that works. It eliminates the client's need to convert between the string type and the type used to hold a code point. Clients can just directly use text in whatever the native encoding is.

    1. Re:new Rune data type by jrumney · · Score: 3, Informative

      A "character" data type has no meaning beyond representing codepoints. There are languages, such as Hindi (and other South Asian languages) and Arabic, where any attempt to output a single character at a time will result in an unreadable mess due to the fact that characters change their shape depending on what comes before or after. So a better rule is not to use strings to represent a character, but to always output whole strings, never individual characters.

  16. Possible replacement for Dalvik into the future? by Pengo · · Score: 3, Interesting

    Does anyone know if this is an R&D project that could be poking at the idea of a litigation free runtime for Android away from Dalvik?

    I'm curious to see how this language evolves and its internal adoption inside of google.

    Regardless of the language taking off or not, it's a great to see a new language enter the ecosystem, and no doubt we'll learn things from it that can be brought back into main-stream languages or interesting innovation that could open the doors for new (pray disruptive) development in new areas.

  17. Re:It lacks a lot of things that you would expect by mounthood · · Score: 2

    Take a look at type embedding: http://golang.org/doc/effective_go.html#embedding

    Go does not provide the typical, type-driven notion of subclassing, but it does have the ability to “borrow” pieces of an implementation by embedding types within a struct or interface.

    --
    tomorrow who's gonna fuss
  18. Re:I like Go by mounthood · · Score: 2

    First, Go has an FFI system like every other language. You can directly compile C code into your binary, and make wrappers with "cgo" for C and C++ libraries. Second, you should read this about dynamic linking -- I don't know if it's perfectly accurate but it's definitely interesting: What does dynamic linking and communism have got in common?

    --
    tomorrow who's gonna fuss
  19. Re:Pi is wrong on the main site by Zoinky · · Score: 4, Informative

    As it mentions in the code, it's an approximation of pi using concurrency. The number of "goroutine" calls used determines the accuracy. In the code comments, they refer you to http://goo.gl/ZuTZM if you want more information on the algorithm they are using. Increasing the accuracy is just a matter of increasing n in their example.

  20. Re:Rube Googleberg Machines? by shutdown+-p+now · · Score: 2

    He is saying that Go is 5-10 times faster to compile than C++, not that the output binary runs faster.

  21. Re:Rube Googleberg Machines? by hanwen · · Score: 4, Interesting

    I write both Go and C++ at google. Sadly, Rob Pike's joke has a definite core of truth: writing C++ code at google is extremely time-consuming and difficult to get right because it has to be multi-threaded and asynchronous.


    Long compile times is more of a build system problem than a compiler problem, IME. Of course, lots of people have broken build systems, and compile the same things over and over again ...

    Well, our in-house developed build system is the best I've ever seen, and probably the best in the industry. Read more about it here. Even with all the niftyness of a thoroughly correct build system and a data-center sized ccache, it still sucks.

    Go is definitely awesome, and I recommend everyone to set aside the gripes with the syntax and learn it. I guarantee you that you'll be pleasantly surprised.

    --

    Han-Wen Nienhuys -- LilyPond