Coder Social home page Coder Social logo

go-tutorial's Introduction

gotutorial

Published Docker Release CodeQL Build tested

An interactive tutorial for go on basis of Jupyter Notebooks and gonb.

It is provided as a self-contained Docker image.

Background

A former employer, asked me to do a tech teaser on the Go programming language before I left the company. Earlier, rather PowerPoint-heavy tech teasers, had the big disadvantage that the learning effect was lower, but they were better suited to the character of a tech teaser. Especially learning a new programming language is much easier when you dig your hands right into the dirt and very short feedback loops move you forward. The idea of using a Jupyter notebook for such a format was born. Because it was clear that the effort of such a "project" would be bigger and therefore would be done in large parts of my free time, I understandably didn't want to just "give away" this work. Fortunately it became possible to create this Jupyter notebook.

The first Jupyter kernel for Golang I used was gophernotes. This was based on gomacro, a REPL for Go. I was thrilled with how easily and quickly the tutorial's repository developed based on small examples. But I also quickly reached the limits of how subtly different the REPL and native Go behaved in individual areas. Then I discovered another Go kernel for Jupyter notebooks, namely gonb. Its concept takes advantage of the fact that the compile time of Golang is so fast that it does without a REPL and builds a Go program before an execution, which is compiled and executed immediately. After adapting all the examples, I am sure that this approach carries better for a tutorial. However, restarting a kernel and executing all cells takes a "relatively" long time. One must be aware of this.

Personally, it was important to me to keep the hurdle to get started with a new programming language as low as possible. Simply start a Docker container and get started right away. That was my idea. A mix of Effective Go and the Go Playground. Supplemented by a usable shell environment and many tools that are helpful in developing Go programs. Therefore, I envisioned that everything that belongs together would come together in a Docker image:

  • The tutorial itself
  • An installation of Jupyter-Lab
  • The Jupyter kernel for Go
  • A shell environment that makes sense
  • All sorts of tools and possibilities around developing Go programs.

So this is the preliminary result, which will hopefully develop steadily. Unfortunately, in the first version I could not finish some topics that are very important from my point of view. But these will surely follow. And who knows... maybe some more tutorials for other programming languages and technologies will follow.

But now have fun trying it out. :-)

Build

build/scripts/build

Execute

docker run -i --rm thednp/go-tutorial

Workflow when developing

build/scripts/go-tutorial init-local
build/scripts/go-tutorial start

# [... working in Jupyter ...]
# [... saving changes ...]

build/scripts/build
build/scripts/go-tutorial start --docker    # open build result on port 8889

# [... check changes ...]
# [... working in Jupyter ...]
# [... saving changes ...]

build/scripts/build
build/scripts/go-tutorial start --docker    # open build result on port 8889

# [... check changes ...]

build/scripts/go-tutorial stop --docker
build/scripts/go-tutorial stop
build/scripts/go-tutorial rm-local

go-tutorial's People

Contributors

docdnp avatar dependabot[bot] avatar

Watchers

 avatar

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.