 Hi everyone, it's Jeff Chow and we're going to, this is a series of screencasts designed to get you started using the Test 161 tool. So at this point, you need to install Go to install Test 161, so this is just a very short introduction to installing Go, and you need to do this on the machine where you run Sys 161. So Go has packages for a bunch of different types of systems, but you need to install this in the place where you build your OS 161 kernels and run them using Sys 161. So there's a couple of options here for installing Go. Go has a bunch of official Go packages here on their website, so you can see they've got Go 1.6 now for Windows, OS X, Linux, and you can build some source. If you just try to install Go using the normal Ubuntu apt-get command, you're probably going to end up with a pretty old version, so you don't want to do that. However, you can use, there's this PPA, a bunch of containers, that packages a pretty recent version of Go. You can see here they've got Go 1.6 release candidate 2 up on their PPA for 14.04 and 15.04 and 15.10, so that's an option if you're on those systems. If you're even 12.04, then that's not an option. Probably my favorite option, though, is to use the Go version manager. So this is sort of a separate project that somebody is maintaining, and what this allows you to do is very easily install multiple versions of Go and switch between them. So let's do that. I've got my ops-class.org virtual machine right here, and I just booted this up. I've got really nothing installed in it except the base OS 162.1 sources, but let's install Go. So we're going to use the Go version manager. There's a couple of things you have to install. First use an app to it just to get us started. That's things that are required by GBM, the Go burnage manager. There's a single command over here on the Go version manager website that will install the Go version manager for you. It's pretty nice. So at this point, you can see that Go version manager relies on modifications to your environment. So if you log out and log back in, you'll have this automatically. Alternatively, if you want to continue on in your same shell, you can just cut and paste that command, and now you should have GBM running. So GBM allows you to install and switch between different versions of Go. After 1.5, Go requires Go to compile. So there's a bootstrapping issue here. Previous versions of Go use the C compiler or some other compiler to build. So what we're going to do is we're going to first install Go version 1.4, then we're going to use that to bootstrap 1.5.3, and then we're going to remove 1.4. So this is pretty simple. We do GoVM install, GVM install, Go 1.4. That's going to show that it's going to download. It's going to build, Go 1.4, and then it's going to install it. Now if you install a version using GVM and you don't set this default flag right here, that will just make that version available to you. It won't actually make that the default. So if you use this default flag, every time you log in to this environment, GVM will set you up to use that particular version of Go by default. In this case, we're only installing Go 1.4 so that we can build Go 1.5, and so we don't want to set that as the default. This is going to take a few minutes. If you haven't tried out Go before, I would encourage you to take a look at it. It's a really very elegant programming language. It has some really neat features, particularly for working with concurrency. Probably the most exciting thing about Go is its support for concurrency, so we'll go down here to this part of the tutorial. In a lot of ways, Go is a compiled language, but it's designed to have the speed of a compiled language as opposed to interpreted languages like Python, but it also has excellent support for concurrency and really a lot of language features that you might associate with interpreted languages. So, for example, it has automatic garbage collection, which is really nice. But the coolest thing about Go, since we're sitting here waiting for it to install, and I can preach about it for just a minute, is its support for concurrency. So if you go over to the Go tour, you can actually play with Go code right in your browser. This is a really neat feature. So I've got some Go code right here. I've got a function here that sleeps for a bit and then prints off a string. And here's my main function. One of the things that you will love about Go, if you start to use it, is that it automatically formats, it will automatically format your code, which is really neat. So for example, Go has a formatting standard that it will adhere to extremely strictly. So if I stick extra spaces in here, the format tool will take care of them. So this is how easy Go makes it to access concurrency on your system. So this is a function that just waits and prints off a string. And here what I'm doing is I'm just using that function three times synchronously. So if I run this code, you can see what it's going to do. Oh, I guess it prints it off a few times, right? So it prints Go's awesome five times, World five times, and Hello five times. And this is pretty typical. This is something that might look a lot like C and act a lot like C. Okay, so over here, we've installed Go 1.4. So let's move on. We're going to tell GVMG to use it, since we need to use it for the next. And you can see if we want to go version, we're using Go 1.4. But all we're doing with Go 1.4 is getting ourselves to Go 1.5. So now let's use that. And in this case, we actually want Go 1.5.3 and we want to use that as the default. So let's install it first. It's going to get started. Okay, so back to the tour of Go. Now here's how easy it is to access concurrency in Go. So let's say I want one of these functions to execute asynchronously. I want it to execute, essentially you can think of it as its own thread. That's all I have to do, so this Go keyword in front of that function. And then, let's try this out a little bit so you can see more of the output. You can see what happens is the output is interleaved. So, say world is running in parallel with the first call to say, which is printing Go is awesome. And so you can see if I run this a couple times, I think that it looks like the output is pretty predictable in this case. Probably has to do with how the remote environment is setting things up. But these two things are running at the same time. So goes, goes neat. And along with that, Go has support for, now that you have a lot of concurrency as support for some really nice primitives that allow you to make concurrency safe. We've talked a little bit in class about how hard that can get, but Go provides some really nice primitives, including the idea of a channel, which is Okay, so at this point, we're compiling Go 1.5.3. Go also comes with a really nice package manager. You're going to see how nice that is in a second. Once we've got 1.5.3 installed and we can install our test 161 tool. All right, this is taking a minute. So bootstrapping compilers is kind of an interesting, I'll just make a remark on that. So you can imagine that it's kind of a neat moment for a language where you can write the compiler for the language in the language itself. So up until Go 1.4, Go was compiled using the C compiler or I don't know, maybe something else. But after this, Go actually compiles itself. So the Go compiler is not written in Go. All right, so I've got Go 1.5.3, I'm going to set that as the default. And just because I don't want to have the old versions hanging around of things, we'll get rid of Go 1.4. Okay, so now if I run Go version and see I'm on Go 1.5.3, which is what I want. Okay, now Go has a couple of environment variables that I would encourage you to look at that have to do with where Go puts things. So in this case, Go set something, GBM set something called the GoPath. You can see this is a hidden directory here in my home directory. And GBM changes this as I switch between different versions of Go. If I go into this directory, back to sets, you'll see right now, there's just a single thing in here that GBM is set up. But when I install the test.1.6.1 tool, there's going to be more things that are going to end up there. Okay, so here we go, let's get test.1.6.1. So the single command will download, build, and install. The test.1.6.1 tool that we're going to use. And you can, this command is safe to run multiple times. If you run it the first time, it'll install it. If you run it the second time, it'll upgrade your test.1.6.2.1 version. As this is happening, what Go is doing is downloading various packages into my GoPath. And now this is finished and you can see now I've got this test.1.6.1 command. So what happened, right? Let's just go take a look at kind of what Go did behind the scenes. So we go back to my GoPath. There's actually a bunch of things in here now, including a source directory. In order to install our test.1.6.1 tool, which comes here, this requires a bunch of other packages. Those other packages have been automatically downloaded by Go from various places. You can see that there's a bunch of them that came from various GitHub repositories as well as things that came from golang.org and gopackage.in, I don't know what that is, but those are other places that provide Go packages. All right, and then the other thing that GBM does automatically for me is it sets up my path to include, in this case, you can see it has this directory in it, which is super helpful. So this now is where the actual test.1.6.1 binary was put. So we go over here and you can see test.1.6.1 is here. So here's our tool, sweet. Okay, so now we have test.1.6.1 installed and at this point I'll move on to the next screencast.