Up to Main Index                         Up to Journal for September, 2012

                  JOURNAL FOR THURSDAY 13TH SEPTEMBER, 2012
______________________________________________________________________________

SUBJECT: 'go get' WolfMUD
   DATE: Thu Sep 13 21:29:55 BST 2012

So I have now worked out how to setup a Git repository and Go imports so that
WolfMUD can be grabbed using 'go get'. These instructions may also help other
people trying to set up something similar.

These example assume 'code.wolfmud.org' is the domain to host the repository
on and 'WolfMUD' is the public repository.

First we setup the bare public Git repository on the server:


  $ mkdir -p /var/www/code.wolfmud.org/WolfMUD
  $ cd /var/www/code.wolfmud.org/WolfMUD
  $ git init --bare --shared=group
  $ git --bare update-server-info
  $ mv hooks/post-update.sample hooks/post-update


Normally I'd name the repository WolfMUD.git but 'go get' does not seem to
like that. The last two lines set up the update hooks and information required
for dumb transports to work.

Next step is to setup a simple virtual host:


  <VirtualHost  127.0.0.1:80>
    ServerName	code.wolfmud.org
    DocumentRoot /var/www/code.wolfmud.org
  </VirtualHost>


Remember to change '127.0.0.1' to your domain's IP address and to use your
domain name and repository name. Then push the code to the public repository.
When doing this it is much easier if the main branch that users should be
using is called 'go1'. Then 'go get' will check out the go1 branch into the
current workspace. If there is not a go1 branch then the branch will be '(no
branch)' until one is checked out manually. Now we should be able to 'go get'
the code:


  $ mkdir ~/WolfMUD
  $ cd WolfMUD
  $ GOPATH=~/WolfMUD go get code.wolfmud.org/WolfMUD.git/...


Notice that here we need 'WolfMUD.git' and not just 'WolfMUD' as the
repository name. Also that there are *THREE* dots at the end of the 3rd line.

You should end up with a tree structure similar to:


  ~
  `-- WolfMUD
      |-- bin
      |-- data
      |-- pkg
      |   `-- linux_amd64
      |       `-- code.wolfmud.org
      |           `-- WolfMUD.git
      |               |-- entities
      |               |   |-- mobile
      |               |   `-- thing
      |               `-- utils
      `-- src
          `-- code.wolfmud.org
              `-- WolfMUD.git
                  |-- client
                  |-- entities
                  |   |-- location
                  |   |-- mobile
                  |   |   `-- player
                  |   |-- thing
                  |   |   `-- item
                  |   `-- world
                  |-- server
                  `-- utils
                      |-- command
                      |-- inventory
                      |-- loader
                      |-- messaging
                      |-- parser
                      |-- sender
                      |-- stats
                      |-- test
                      |-- text
                      |-- uid
                      `-- units


Now we can start the server:


  $ cd ~/WolfMUD/bin
  $ ./server


Alternatively instead of using 'go get' you can use git directly:


  $ mkdir -p ~/WolfMUD/src/code.wolfmud.org
  $ cd ~/WolfMUD/src/code.wolfmud.org
  $ git clone -bgo1 https://code.wolfmud.org/WolfMUD WolfMUD.git
  $ GOPATH=~/WolfMUD go install -v ...
  $ cd ~/WolfMUD/bin
  $ ./server


When writing imports they are now referenced as:


  import "code.wolfmud.org/WolfMUD.git/server"


Now I guess I'd better write up the README file on how to 'go get' WolfMUD...

--
Diddymus


  Up to Main Index                         Up to Journal for September, 2012