# Google Go programming language - any role in the BSD world?



## DutchDaemon (Nov 11, 2009)

Go is an open source project, distributed under a BSD-style license.


```
// Copyright (c) 2009 The Go Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//    * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//    * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//    * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```


----------



## CodeBlock (Nov 11, 2009)

Hm, I was doing some searching to see what I'm going to learn when I finish learning Python/Django. Maybe this is worth looking into, it seems interesting. My other choice was Java, though I'm not too sure if that would pay off and be worth learning.


----------



## ckester (Nov 12, 2009)

I've been interested in concurrency issues ever since I started programming back in the 1980's.    I've read some of what Rob Pike has written about CSP-style channels in languages like Newsqueak and Limbo, but since I never got around to installing Plan 9 or Inferno, I haven't had a chance to try them out for myself.   So I'm hoping we get a port of Go to FreeBSD.


----------



## varnie (Nov 12, 2009)

it is very fascinating and interesting but i didn't see Go in FreeBSD ports available.


----------



## SirDice (Nov 12, 2009)

varnie said:
			
		

> it is very fascinating and interesting but i didn't see Go in FreeBSD ports available.



Google released go a few days ago. It's going to take some time for someone to pick it up and create a port for it. That's assuming someone is willing to put the effort in :e


----------



## Ruler2112 (Nov 12, 2009)

Whenever I read something like this, I wonder just how many Java-like languages we really need...  (From a 10-minute cursory skimming of the go site, it appears to be very similar.)


----------



## TerryP (Nov 12, 2009)

A search on their mailing list, turned up this, which suggests it shouldn't be to horrible a task to port to FreeBSD. I've been thinking of trying to get it working on my laptop, but more pressing matters need doing first.


From what I've seen so far, Go looks as ugly as Lisp, Perl, and C++ having a threesome in the back yard. However, I find it strangely appealing, who knows, perhaps it will replace C & C++ to some extent in 10 or 15 years, if it gains suitable access to common C/C++ libraries by then.


The goroutine stuff alone, looks like a sexy boost over C programming, as long as we can still fork();.


----------



## CodeBlock (Nov 13, 2009)

TerryP said:
			
		

> From what I've seen so far, Go looks as ugly as Lisp, Perl, and C++ having a threesome in the back yard. However, I find it strangely appealing,



You know- I could be having the worst day of my life, and come on here, and find a post that cheers me up. That cracked me up . You've also earned my 150th post.


----------



## TerryP (Nov 13, 2009)

Glad to be of service CodeBlock ;-)


----------



## DutchDaemon (Nov 13, 2009)

Terry, are you actually referring to the _act_ or the possible _offspring_?
(please refrain from using the terms 'spawn', 'kill', and 'child')


----------



## TerryP (Nov 14, 2009)

The act, I thought that was perfectly clear .


So, has anyone here actually tried it yet? :-D


----------



## DutchDaemon (Nov 14, 2009)

TerryP said:
			
		

> So, has anyone here actually tried it yet? :-D



It's way too cold in the back yard.


----------



## ckester (Nov 14, 2009)

Just saw this on the Go mailing list.  Someone IS working on a FreeBSD port.

http://codereview.appspot.com/user/dho

According to Russ Cox, "it seems to be very close."


----------



## ckester (Nov 14, 2009)

Ruler2112 said:
			
		

> Whenever I read something like this, I wonder just how many Java-like languages we really need...  (From a 10-minute cursory skimming of the go site, it appears to be very similar.)



One big difference: Go doesn't produce bytecode to run in a virtual machine.  In this respect, it's more like C or C++.

But, as I said above, my main interest is in how Go handles concurrency.  Specifically its use of CSP-style channels.   I think having good language support for concurrency is going to be one of the key elements of success in today's multiprocessor, multicore world.  Parallel computing is still too hard (or too easy to get wrong, to put it in another way.)  So I'm interested in anything that addresses those issues.


----------



## ckester (Nov 14, 2009)

BTW, isn't this thread in the wrong forum?  I think it should be in the Userland Programming forum instead.


----------



## DutchDaemon (Nov 14, 2009)

Userland was not what I was thinking of when I posted this. FreeBSD development and coding (_that_ BSD world) was.


----------



## ckester (Nov 14, 2009)

DutchDaemon said:
			
		

> Userland was not what I was thinking of when I posted this. FreeBSD development and coding (_that_ BSD world) was.



I think Go is more likely to be used for userland apps than for kernel or world.  At least until it gets out of its current experimental phase.


----------



## DutchDaemon (Nov 14, 2009)

Sure, but that's really a no-brainer.. So that would be a superfluous topic in the userland forum  I'm sure it will be in ports soon and used like all the other languages in /lang/.


----------



## ckester (Nov 15, 2009)

On second thought, I probably went too far when I said that's more likely that Go will be used for userland apps than for world. 

I can see it being used to implement various server daemons.


----------



## estrabd (Nov 18, 2009)

TerryP said:
			
		

> From what I've seen so far, Go looks as ugly as Lisp, Perl, and C++ having a threesome in the back yard. However, I find it strangely appealing, who knows, perhaps it will replace C & C++ to some extent in 10 or 15 years, if it gains suitable access to common C/C++ libraries by then.



And it ain't the first time. From where do you think D came? Not that I don't find D (not so) strangely appealing. 



			
				TerryP said:
			
		

> The goroutine stuff alone, looks like a sexy boost over C programming, as long as we can still fork();.



To me, this language looks like an attempt to make so called "cloud" computing more accessible to the programmer. And the logo I've seen looks strangely like Plan 9's Glenda...so maybe she was involved in the romp, too. I am not very excited about it, but will follow it to see where it goes.


----------



## ckester (Nov 19, 2009)

*mascots*



			
				estrabd said:
			
		

> And the logo I've seen looks strangely like Plan 9's Glenda...so maybe she was involved in the romp, too.



Plan 9's Glenda and Go's gopher were both created by Renee French -- who is married to Rob Pike.


----------



## rdeiriar (Nov 24, 2009)

Thanks to the excellent porting effort by Devon O'Dell go does work on FreeBSD. Build instructions are the same as for other platforms, just set GOOS=freebsd. 

```
[roberto@t42 ~/gosrc]$ cat hello.go
package main

import "fmt"

func main() {
   fmt.Printf("hello, world\n")
}
[roberto@t42 ~/gosrc]$ 8g hello.go
[roberto@t42 ~/gosrc]$ 8l hello.8
[roberto@t42 ~/gosrc]$ ./8.out
hello, world
[roberto@t42 ~/gosrc]$ uname -a
FreeBSD t42 8.0-PRERELEASE FreeBSD 8.0-PRERELEASE #0: Mon Nov 23 08:42:00 CLST 2009     root@t42:/usr/obj/usr/src/sys/GENERIC  i386
```


----------



## rdeiriar (Nov 24, 2009)

*Go build instructions on FreeBSD*

Follow these instructions to build Go on FreeBSD

The following packages are required, install them from ports or packages at your convenience.

bash
gmake
bison
mercurial

The rest assumes that you are using bash, and that you are going to build the system under $HOME/go, binaries going to $HOME/bin.
Create $HOME/go and, if needed $HOME/bin, then


```
export GOROOT=$HOME/go
export GOARCH=amd64
export GOOS=freebsd
export GOBIN=$HOME/bin
hg clone https://go.googlecode.com/hg/ $GOROOT
cd $HOME/go/src/
./all.bash
```

If the build is successful, it should end with


```
--- cd ../test
X known bugs; 0 unexpected bugs
```

Where X is the number of bugs known at the moment

For the i386 platform, use GOARCH=386

Regards,
Roberto.


----------



## ckester (Nov 25, 2009)

rdeiriar said:
			
		

> Thanks to the excellent porting effort by Devon O'Dell go does work on FreeBSD. Build instructions are the same as for other platforms, just set GOOS=freebsd.



Sweet!  I'll install this first thing after upgrading to 8.0.


----------



## dho (Nov 30, 2009)

If you have any questions, email me. I'm having some issues getting to a FreeBSD/i386 SMP machine right now and there's apparently a latent bug in there. If anybody could help out with that, it would be nice.

--dho


----------



## estrabd (Feb 27, 2010)

ckester said:
			
		

> Plan 9's Glenda and Go's gopher were both created by Renee French -- who is married to Rob Pike.



It goes beyond just that, I have recently learned!

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

_This site aims to collect various information and other resources about the Go programming language designed by Ken Thompson, Rob Pike and Robert Griesemer at Google._


----------



## oliverh (Mar 25, 2010)

http://blog.golang.org/2010/03/go-whats-new-in-march-2010.html

According to this blog entry, FreeBSD is now a supported operating system.


----------

