(Go Lang) Go by Example Notes (GBEN) Emacs Setup


Go by Example is Mark McGranaghan‘s “hands-on introduction to Go using annotated example programs”. Under the license I’m going to

  • Convert all of the examples to Org-Mode Literate Programming documents
  • Add, remove and modify them making it my personal notebook
  • Add the tag GBEN to track them
  • Refer to this post to provide attribution


ID: org_gcr_2017-08-08_mara:C327B697-D6B7-42BA-B0D3-0C8613CBB58E

How to setup Emacs and Org-Mode for GBEN:

  • Set up Emacs to your liking
  • Set up Go, Required Components, ob-go and copy as much of my Go config as you like. For example it includes a Hydra for compiling and more
  • Download this post from GitHub to see the configuration of the source block
    • If you want full source code you can
      • Expand the source block with org-babel-expand-src-block for your inspection
      • I tried expanding the source block into an example and didn’t figure it out. When I do I will update these examples. However, it is probably OK if I don’t because I have the source code.
  • Set Org-Mode version 9 or greater
    • Here is the base configuration

      <<<ECM Information>>>
      As Of: 2017-08-08T20-51-57
      Org-Version: 9.0.9
      Emacs-Version: GNU Emacs 25.2.1 (x86_64-apple-darwin15.6.0, Carbon Version 157 AppKit 1404.47)
       of 2017-07-28
      Noweb wrap start and stop delimeters: ’«’ and ’»’
      ((:session . "none")
       (:results . "replace")
       (:exports . "code")
       (:cache . "no")
       (:noweb . "no")
       (:hlines . "no")
       (:tangle . "no"))
    • Here is the configuration for the source blocks however I will be using output for nearly all of the examples despite my default configuration being scalar!

          Name: org_gcr_2017-08-08_mara_B27781B4-01DB-4FB7-A591-08EFCEB8C206
      Lang: go
        :header-args    nil
        :header-args:go   nil
      Header Arguments:
        :cache    no
        :comments   noweb
        :eval     never-export
        :exports  both
        :hlines     no
        :mkdirp     yes
        :noweb    no-export
        :padline  yes
        :results  replace drawer scalar value
        :session  none
        :tangle     no
        :wrap     EXAMPLE

Leave a Reply

Your email address will not be published. Required fields are marked *