Coder Social home page Coder Social logo

goshop's Introduction

goshop

Prepare go

GOPATH=~/projects/go
mkdir -p $GOPATH
echo "export GOPATH=$GOPATH" >> ~/.bashrc
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
source ~/.bashrc

goshop download

go get github.com/rofrol/goshop
cd $GOPATH/src/github.com/rofrol/goshop

Download css and js

wget http://foundation.zurb.com/cdn/releases/foundation-5.0.3.zip
unzip foundation-5.0.3.zip -d static/foundation
rm foundation-5.0.3.zip

perm

download openssl http://www.openssl.org/related/binaries.html

generate cert http://stackoverflow.com/questions/10175812/how-to-build-a-self-signed-certificate-with-openssl

mkdir tls && cd tls
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes

Run it

sh db/init.sh
go get .
goshop

Go to https://localhost:9000 and https://localhost:9000/admin (login and password from db/schema.sql)

Go - Managing versions

Q: How about automatic version managment in go?

A: Versioning cannot be correctly done automatically for non trivial cases. The trivial cases are few minutes of manual work.

Q: What is the proper way to manage two different versions of the same package

A: The name of a package is equivalent to the first number of a semantic version -- e.g., a package foo exposes a backward compatible interface always and forever. If a breaking change becomes necessary, the name of the package changes to, e.g., foo2 or something.

Q: where does the convention of package names being the major version come from? That is to use foo, foo2, foo3, etc.

A: It comes from Rob Pike and the core Go development team. See the FAQ http://golang.org/doc/faq#get_version . He doesn't state it like I do though; but, the end result is the same. According to semver, if you make a breaking, incompatible change, you bump the 1st semver number. According to Go community convention, if you make a breaking change, you are advised to call your package a new name. The syntax of the "name" may be different, but the core ideas are the same.

https://plus.google.com/113468371879331813621/posts/P4rcZAsHPTB

HTTP Redirect

Remember to add return after Redirect, if you want to exit function.

	http.Redirect(w, r, "/admin/products", http.StatusSeeOther)
	return

http://en.wikipedia.org/wiki/Post/Redirect/Get

http://en.wikipedia.org/wiki/HTTP_303

303 for HTTP 1.1, maybe problem with old corporate proxies, so 302 could be better http://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get

The common practice is to redirect only after successful forms. So forms with errors are treated by the same POST request, and so have access to the data. https://groups.google.com/forum/?fromgroups#!msg/golang-nuts/HeAoybScSTU/qxp1H7mWZVYJ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.