Twelve Go Best Practices
Francesc Campoy Flores Gopher at Google @francesc http://campoy.cat/+
- Best practices
Verifying my Blockstack ID is secured with the address 151Qz6KT4WrdFRg1G828yU3zjTNuYq1fa2 https://explorer.blockstack.org/address/151Qz6KT4WrdFRg1G828yU3zjTNuYq1fa2 |
# Tip calculator | |
# (15%, 18% and 20%) | |
while True: | |
try: | |
user_input = input("What is the total of your check? > $") | |
total_check = float(user_input) | |
break | |
except ValueError: | |
print("I'm sorry, looks like you typed something incorrectly. Try typing in a number! :)") |
using UnityEngine; | |
using System.Collections; | |
public class mmBallRoll : MonoBehaviour { | |
public mmGameManagerController gm; | |
private Rigidbody myRb; | |
// Use this for initialization | |
void Start () { |
First get into your EC2 server | |
If you have already run | |
$ sudo apt-get install golang | |
and you have | |
$ go version | |
go version go1.2.1 linux/amd64 | |
or something else out of date, you need to remove it before anything | |
$ rm -r go | |
$ sudo apt-get remove golang |
Twelve Go Best Practices
Francesc Campoy Flores Gopher at Google @francesc http://campoy.cat/+
package main | |
import ( | |
"fmt" | |
"github.com/gorilla/mux" | |
"github.com/gorilla/securecookie" | |
"net/http" | |
) | |
// cookie handling |
package main | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"time" | |
) | |
type Person struct { |
$ mkdir $HOME/mygo_projects | |
$ export GOPATH=$HOME/mygo_projects | |
$ go get github.com/gocraft/web |
Assuming you have virtualenv,virtual wrapper, python and pip already installed. | |
$mkvirtualenv yourproject //this creates your project in a virtual environment | |
You will see you are in your virtualenv project because it will look like this - | |
(yourproject)yourcomputer~/desktop$ | |
$pip install django // install django | |
$pip install django toolbelt | |
$django-admin.py startproject yourproject //this starts django off | |
Now cd into your new project folder | |
cd yourproject | |
Now get Core |
Once you have Hugo installed - type in terminal | |
hugo help | |
if you see the help options, all is good. Now create a folder in directory of choice | |
mkdir myBlog | |
cd into into your new folder | |
cd myblog | |
Now you can create your hugo blog by typing | |
hugo new site . | |
The . tells it to put it in the directory it is in,(but you can put another direct path if you like). | |
Open up your folder in your editor and you will see new folders there. |