{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Package Oriented Design in GO\n", "---\n", "\n", "@SatyamZode\n", "\n", "---\n", "\n", "![](myopenebs-go.jpg)\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Package Oriented Design Philosophies\n", " \n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Purpose" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Usability" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Portability" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Project Structure\n", "\n", "---\n", "\n", "```\n", "Kit Application\n", "\n", "├── CONTRIBUTORS ├── cmd/\n", "├── LICENSE ├── internal/\n", "├── README.md │ └── platform/\n", "├── cfg/ └── vendor/\n", "├── examples/\n", "├── log/\n", "├── pool/\n", "├── tcp/\n", "├── timezone/\n", "├── udp/\n", "└── web/\n", "```" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Listing 1 \n", "---\n", "\n", "```\n", "github.com/ardanlabs/kit\n", "├── CONTRIBUTORS\n", "├── LICENSE\n", "├── README.md\n", "├── cfg/\n", "├── examples/\n", "├── log/\n", "├── pool/\n", "├── tcp/\n", "├── timezone/\n", "├── udp/\n", "└── web/\n", "```" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Listing 2\n", "---\n", "\n", "```\n", "github.com/servi-io/api\n", "├── cmd/\n", "│ ├── servi/\n", "│ │ ├── cmdupdate/\n", "│ │ ├── cmdquery/\n", "│ │ └── servi.go\n", "│ └── servid/\n", "│ ├── routes/\n", "│ │ └── handlers/\n", "│ ├── tests/\n", "│ └── servid.go\n", "├── internal/\n", "│ ├── attachments/\n", "│ ├── locations/\n", "│ ├── orders/\n", "│ │ ├── customers/\n", "│ │ ├── items/\n", "│ │ ├── tags/\n", "│ │ └── orders.go\n", "│ ├── registrations/\n", "│ └── platform/\n", "│ ├── crypto/\n", "│ ├── mongo/\n", "│ └── json/\n", "└── vendor/\n", " ├── github.com/\n", " │ ├── ardanlabs/\n", " │ ├── golang/\n", " │ ├── prometheus/\n", " └── golang.org/\n", "```" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Contributing to (Forked) Golang Projects\n", "---\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "### Why? What's the problem? " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "### Problem : \n", "---\n", "\n", "```\n", "cb@satyamz:~/go/src/github.com/satyamz/Tasks$ go build \n", "main.go:13:2: cannot find package \"github.com/thewhitetulip/Tasks/config\" in any of:\n", "\t/usr/local/go/src/github.com/thewhitetulip/Tasks/config (from $GOROOT)\n", "\t/home/cb/go/src/github.com/thewhitetulip/Tasks/config (from $GOPATH)\n", "main.go:14:2: cannot find package \"github.com/thewhitetulip/Tasks/views\" in any of:\n", "\t/usr/local/go/src/github.com/thewhitetulip/Tasks/views (from $GOROOT)\n", "\t/home/cb/go/src/github.com/thewhitetulip/Tasks/views (from $GOPATH)\n", "cb@satyamz:~/go/src/github.com/satyamz/Tasks$ \n", "\n", "```" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Contributing to (Forked) Golang Projects : Solution 1 \n", "--- \n", " " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "### Add Remote " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "* Go get the main repo\n", "\n", "```\n", " $go get github.com/thewhitetulip/Tasks\n", "\n", "```\n", "* Add your forked repo as a remote\n", "\n", "```\n", " $git remote add satyamz-tasks-fork http://github.com/satyamz/Tasks\n", "```\n", "* Work with your remote \n", "\n", "```\n", " $git pull --rebase satyamz-tasks-fork\n", " $git push satyamz-tasks-fork\n", "\n", "\n", "```\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "### Contributing to (Forked) Golang Projects : Solution 2 \n", "--- \n", " " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "### Cheat '`go get`' " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "fragment" } }, "source": [ "```\n", "cd $GOPATH\n", "\n", "mkdir -p {src,bin,pkg}\n", "\n", "mkdir -p src/github.com/thewhitetulip/\n", "\n", "cd src/github.com/thewhitetulip/\n", "\n", "git clone git@github.com:satyamz/Tasks.git # OR: git clone https://github.com/satyamz/Tasks.git\n", "\n", "cd Tasks/\n", "\n", "go get ./...\n", "\n", "```" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## References : \n", "\n", "* Talk by William Kennedy at GopherCon India 2017\n", "* https://www.goinggo.net/2017/02/package-oriented-design.html\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Thank you! " ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Join Us\n", "---\n", "![](medium-size.png)" ] } ], "metadata": { "celltoolbar": "Slideshow", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.0" } }, "nbformat": 4, "nbformat_minor": 2 }