Start coding

Anthony Voutas
3 min readJun 17, 2018

--

In the last post, I decided on using Go and I said I would create a git repository in this post.

An aside: I’m making all the code in this project open source. That means anybody is free to copy and change the code and even make money off it, provided the part of the code that I wrote is attributed to me explicitly. The main reason for making it open source is that the openness of the code works well with the documentary nature of this blog. I can link directly to it and you can actually get the code, run it, change it, run it again, and learn from it.

There are a few other reasons: 1) I doubt it will have much monetary value as a product; 2) Even if there is potential for selling it I can still do that for the people who are willing to pay for it; 3) If it’s an unexpectedly big hit I can use it as a loss leader and make other games with the same studio name; 4) The subject matter (AI risk) is of critical societal importance so I will forgo money in favor of spreading the message; and 5) Information wants to be free.

That all being said, let’s make a git repository. Oh crud, I need to come up with a name. How about we use a working title? I dunno let’s go with “game”.

I’m lazy so I’m going to use a tool I wrote to create a github repo from the terminal.

$ gh mk game
$ open https://github.com/voutasaurus/game

On Github I’ll create README.md and a LICENSE files. Now back in the terminal.

$ pwd
/Users/vout/go/src/github.com/voutasaurus
$ git clone https://github.com/voutasaurus/game
Cloning into 'game'...
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
$ cd game
/Users/vout/go/src/github.com/voutasaurus/game
$ ls
LICENSE README.md

Now I’ll create a main package.

$ vim main.go

And vim shows (thanks to vim-go):

1 package main
2
3 import "fmt"
4
5 func main() {
6 fmt.Println("vim-go")
7 }

By the way, I have turned off syntax highlighting. This is my ~/.vimrc file:

syntax off
let g:go_fmt_command = “goimports”
set clipboard=unnamed
set number

I’m going to change vim-go to game, save and quit :wq , then:

$ go run main.go
game

Cool.

$ git st
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
main.gonothing added to commit but untracked files present (use "git add" to track)
$ git add .
$ git commit -m "add game"
$ git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 358 bytes | 358.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/voutasaurus/game
dda085c..0917ea1 master -> master

Now my fmt.Println is on the interwebs for the world to enjoy. Bonus.

You may have noticed the git alias st. I don’t use many git aliases, I only set up the two most useful ones (git co and git ci confuse me and spelling out git branch is preferable given how little I use it). Here they are, plus one I added because it was meta and I will take any opportunity to be meta:

$ git aliases
alias.st status
alias.unstage reset HEAD --
alias.aliases config --get-regexp '^alias\.'

I had to look up how to list aliases.

I also mucked around with git init a little bit and git add remote before realizing that git clone was way easier, especially in combination with my Github tool gh mk.

I also had to look up what the vim config file was called because I forgot. Apparently the rc in ~/.vimrc is pure arcana. As fun as arcana is in D&D, all this arbitrary meaningless cruft is a waste of brain cells, especially for people trying to break into the software field.

In this blog series I’m going to make an effort to emphasize some of the specifics that prove I did not pull a perfect crystal out of nowhere. I feel like that’s often missing from blog posts and videos about software and whenever I see somebody being honest about it I personally find it refreshing. Plus this time by being open about it I learned some useless arcana which I can now repeat to other people in order to sound smart. Bonus.

Next time I’ll write a terminal loop. I’m planing to use the help of the golang.org/x/crypto/ssh/terminal package.

[Update: I decided to set up a release pipeline first]

--

--