Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GoSXBGo! - Setup your environment

Soulou
November 04, 2015
67

GoSXBGo! - Setup your environment

Soulou

November 04, 2015
Tweet

Transcript

  1. Go Installation https://golang.org/dl/ (https://golang.org/dl/) But faster here: 192.168.1.97:6789/ (http://192.168.1.97:6789/) Linux

    SHA1: 46eecd290d8803887dec718c691cc243f2175fe0 MacOS SHA1: 857b77a85ba111af1b0928a73cca52136780a75d Windows SHA1: 0a439f49b546b82f85adf84a79bbf40de2b3d5ba Version 1.5.1
  2. GOROOT - Installation path Windows: Automatically defined during installation C

    : \ g o Mac OS: Automatically defined during installation / u s r / l o c a l / g o Linux: Extract .tar.gz in /opt and add in you ~/.bashrc or ~/.zshrc e x p o r t G O R O O T = / o p t / g o
  3. GOPATH - Your projects This directory will be the root

    of ALL your go code and their dependencies Yes it's tough, but super helpful
  4. GOPATH - Goodbye habits p r o j e c

    t s / p r o j e c t 1 / s r c / m a i n . g o l i b / p a c k a g e 1 . g o p r o j e c t 2 / s r c / s e r v e r . g o
  5. GOPATH - Hello go rules $ G O P A

    T H / b i n / p r o j e c t 1 p r o j e c t 2 p k g / l i n u x _ a m d 6 4 / g i t h u b . c o m / S o u l o u p a c k a g e 1 . a s r c / g i t h u b . c o m / S o u l o u / p a c k a g e 1 / l i b . g o p r o j e c t 1 / m a i n . g o p r o j e c t 2 / s e r v e r . g o
  6. Set GOPATH Linux/MacOS (~/.bashrc|~/.zshrc): e x p o r t

    G O P A T H = $ H O M E / g o Windows: Configuration Panel -> System -> Advanced -> Environment Variables -> Locate PATH - > Edit -> Add GOPATH Linux/MacOS (~/.bashrc|~/.zshrc): e x p o r t P A T H = $ P A T H : $ G O R O O T / b i n : $ G O P A T H / b i n Windows: (-- snip --) -> Add GOPATH to your PATH
  7. Useful tools g o g e t g i t

    h u b . c o m / t o o l s / g o d e p More of that in the exercises
  8. If everything is OK Run a terminal and try out

    the following commands $ e c h o $ G O R O O T - $ G O P A T H / o p t / g o - / h o m e / l e o / P r o j e c t s / G o $ g o G o i s a t o o l f o r m a n a g i n g G o s o u r c e c o d e . . . .
  9. Next step: the editor VIM https//github.com/fatih/vim-go.git (https//github.com/fatih/vim-go.git) Best plugin ever

    Auto install dependencies, clever completion, Go tool helpers, Goto definition, GoOracle Emacs tleyden.github.io/blog/2014/05/22/configure-emacs-as-a-go-editor-from-scratch/ (https://tleyden.github.io/blog/2014/05/22/configure-emacs-as-a-go-editor-from-scratch/) Sublime www.wolfe.id.au/2015/03/05/using-sublime-text-for-go-development/ (http://www.wolfe.id.au/2015/03/05/using-sublime-text-for-go-development/)
  10. Clone the skeleton g i t c l o n

    e h t t p s : / / g i t h u b . c o m / g o - s x b - g o / v e r s i o n 2 - e x e r c i s e s - s k e l e t o n . g i t c d v e r s i o n 2 - e x e r c i s e s - s k e l e t o n
  11. How to test your code g o t e s

    t . Except if README tells you something else
  12. Questions If you have questions just ask... Google Someone more

    advanced (who'll learn by explaining) Me ☺
  13. Credits Gopher images by Renee French under Creative Commons Attributions

    3.0 More gopher images here (https://blog.golang.org/gopher)