Setup recommended golang environment

This commit is contained in:
Darren Coxall
2013-05-02 08:46:45 +01:00
parent 7f58e1e8d0
commit 30632f4aad
7 changed files with 52 additions and 0 deletions

1
.gitignore vendored
View File

@@ -20,3 +20,4 @@ _cgo_export.*
_testmain.go _testmain.go
*.exe *.exe
.vagrant

12
Vagrantfile vendored Normal file
View File

@@ -0,0 +1,12 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "debian-607-x64-vbox4210"
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/debian-607-x64-vbox4210.box"
config.vm.provision :puppet do |puppet|
puppet.module_path = "modules"
puppet.manifests_path = "manifests"
puppet.manifest_file = "init.pp"
end
end

0
bin/.gitkeep Normal file
View File

3
manifests/init.pp Normal file
View File

@@ -0,0 +1,3 @@
class { "golang":
version => "1.1rc1"
}

View File

@@ -0,0 +1,29 @@
class golang ( $version = "1.0.3" ) {
exec { "download-golang":
command => "/usr/bin/wget -O /usr/local/src/go$version.linux-amd64.tar.gz https://go.googlecode.com/files/go$version.linux-amd64.tar.gz",
creates => "/usr/local/src/go$version.linux-amd64.tar.gz"
}
exec { "remove-previous-version":
command => "/bin/rm -r /usr/local/go",
onlyif => "/usr/bin/test -d /usr/local/go",
before => Exec["unarchive-golang-tools"]
}
exec { "unarchive-golang-tools":
command => "/bin/tar -C /usr/local -xzf /usr/local/src/go$version.linux-amd64.tar.gz",
require => Exec["download-golang"]
}
exec { "setup-path":
command => "/bin/echo 'export PATH=/vagrant/bin:/usr/local/go/bin:\$PATH' >> /home/vagrant/.profile",
unless => "/bin/grep -q /usr/local/go /home/vagrant/.profile ; /usr/bin/test $? -eq 0"
}
exec { "setup-workspace":
command => "/bin/echo 'export GOPATH=/vagrant' >> /home/vagrant/.profile",
unless => "/bin/grep -q GOPATH /home/vagrant/.profile ; /usr/bin/test $? -eq 0"
}
}

0
pkg/.gitkeep Normal file
View File

7
src/hello/hello.go Normal file
View File

@@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}