ad: elecraft

Sell me on Go

Discussion in 'Computers, Hardware, and Operating Systems' started by N0NB, May 6, 2018.

ad: L-HROutlet
ad: l-rl
ad: l-assoc
ad: Left-3
ad: MessiPaoloni-1
ad: Subscribe
ad: Left-2
ad: L-MFJ
  1. N0NB

    N0NB Subscriber QRZ Page

    Yesterday morning I came across a link to Eric S. Raymond's blog to The big break in computer languages whereupon he hammers on C++ (deservedly so as it is completely out of reach to a hobbyist like myself, i.e. the learning curve is much too steep) and also links to a previous blog, The long goodbye to C. I had heard of Go, of course, but so far wasn't aware of any major projects coded in it. I checked out the Website and started on the tutorial which failed because I needed to have the GOPATH environment variable set, which is trivial. Then I tried again and was met with:

    Code:
    $ go get golang.org/x/tour/gotour
    package golang.org/x/tour/gotour
            imports golang.org/x/tools/godoc/static
            imports golang.org/x/tools/imports
            imports context: unrecognized import path "context"
    
    Hmmm, a quick Google shows that the context error basically means that my run time Go is too old:

    Code:
    $ go version
    go version go1.4.2 gccgo (GCC) 5.5.0 linux/amd64
    
    .

    on Slackware 14.2.

    Okay, I understand things get out of date, but shouldn't such a highly touted compiler at least print as an error message something useful like, "Your copy of Go is too old..." That seems a bit more acceptable than what was printed. It's quite likely that "context" is much newer than my version can support, but that didn't seem immediately obvious.

    What good is it going to be to put Go into a stable Linux distribution if it's far enough out of date as to be useless in a matter of months? I have a project that should be converted from C/GTK2 to something else (I thought about Python3 with PyQt, but that combination is wildly inconsistent across distributions the last time I checked. Python3 with Tkinter is about the only sane choice). After reading ESR's almost breathless endorsement, I thought Go might be a useful choice. Now I am not so sure.

    Those of you that know Go, convince me that I'm being rash by dismissing it after a few minutes.
     
  2. N0NB

    N0NB Subscriber QRZ Page

    I'm probably quite mistaken now as it turns out that what I thought was Go is actually the Go frontend to GCC which probably lacks some of the things required of the online Go tutorial, especially since this is based on GCC 5.5 that is getting rather long in the tooth. Still, I'd like to hear from anyone using Go for a project.
     
  3. K1ABX

    K1ABX Ham Member QRZ Page

  4. N0NB

    N0NB Subscriber QRZ Page

    I'm mostly interested in any desktop projects written in Go. Most of the stuff I've found seems to be server farm oriented. Are there graphics libraries available for it. As Go seems very network oriented, can programs written in it be compiled "offline"? In C and other languages once any libraries are installed, a network connection is not required for compilation.

    I like Python's philosophy of "batteries included" which means that most of the coding one will do can be done with the library installed with the interpreter, though third party libraries are certainly available.
     
  5. KA8NCR

    KA8NCR Ham Member QRZ Page

    Go kicks the snot out of Java in memory efficiency, tends to be a little faster in most use cases (but not all) and doesn't require Jetty, Springboot or other help in becoming useful as a web/REST API. It has a rich HTML/CSS templating engine that makes creating a simple static content engine a snap. There are many, such as Hugo. But the benchmarks below are not Java 10, which is supposed to resolve problems with the runtime garbage collection and memory management, especially for containers (my biggest peeves about running Java).

    https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go.html

    Python? Leaves that in the dust. https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/go-python3.html

    The only similar language that might be faster is Rust, but Rust lacks a cohesive framework and while there are many projects to create them, it will be a while.

    If you are writing some RESTFUL application, Go has a pretty quick learning curve for people coming from Java or C.
     
  6. N0NB

    N0NB Subscriber QRZ Page

    So it's intended for Web/server stuff and not for a desktop application. Thanks.
     
  7. K1ABX

    K1ABX Ham Member QRZ Page

    By that logic C is intended for console applications and daemons. Go was created in a particular environment with intention to address specific
    issues first, but is a universal programming language. Take a look at this : https://github.com/gotk3/gotk3
     
  8. K1ABX

    K1ABX Ham Member QRZ Page

    That's a difference in standard libraries (and philosophies around them) which isn't really a defining feature of the language. Creators of Java decided not to
    implement certain things, but only to standardize the APIs, while leaving implementation details to third parties. Creators of Go decided to provide an
    implementation for certain things from the start, as they were aiming for specific "customers" from the beginning who needed those things anyway.
    This may result in better standardization, or may do nothing at all, with opensource community reimplementing the same features a dozen times.
    Either way, when comparing programming languages, one needs to be careful not to omit the fine lines between the language, runtime and the
    standard library.
     
  9. KA8NCR

    KA8NCR Ham Member QRZ Page

    But memory efficiency and general snappiness are. Java 10 fixes a number of long standing grievances I have with the run time, but they only did it because containers were going to force people to rethink enterprise Java use.
     
    K1ABX likes this.
  10. K1ABX

    K1ABX Ham Member QRZ Page

    I must add the change in philosophy wasn't prompted as much by containers, as much by the microservices architecture. Java is great when you have to implement complex
    monolithic applications. It has quite a bit of unnecessary overhead for an application that is nothing more than a RESTful "hello world".
     

Share This Page