Setup recommended golang environment
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -20,3 +20,4 @@ _cgo_export.*
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
.vagrant
|
||||
|
||||
12
Vagrantfile
vendored
Normal file
12
Vagrantfile
vendored
Normal 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
0
bin/.gitkeep
Normal file
3
manifests/init.pp
Normal file
3
manifests/init.pp
Normal file
@@ -0,0 +1,3 @@
|
||||
class { "golang":
|
||||
version => "1.1rc1"
|
||||
}
|
||||
29
modules/golang/manifests/init.pp
Normal file
29
modules/golang/manifests/init.pp
Normal 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
0
pkg/.gitkeep
Normal file
7
src/hello/hello.go
Normal file
7
src/hello/hello.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Printf("hello, world\n")
|
||||
}
|
||||
Reference in New Issue
Block a user