Learn how to write webapps without a framework in Go.

Overview

About the book

Join the chat at https://gitter.im/thewhitetulip/web-dev-golang-anti-textbook

Source Read online Watch Download Code Pay?
Github Gitbooks YouTube series leanpub Tasks This book is free, but if you want to pay, you can buy it on leanpub.

What is this?

This is an easy to understand example based tutorial aimed at those who know a little of Go and nothing of webdev and want to learn how to write a webserver in Go. You will create a to do list application as you advance the chapters.

Please use the front end folder in the code folder to get the index.html of the Tasks project and work on it while reading this tutorial.

Supporting Docs

We have a YouTube series and a fully functioning web application as supporting documents. Tasks is the application which you'll as you read into the book

If you prefer learning by watching, YouTube series. The code corresponding to the YouTube series is available here. The code is published as branches, each video has a particular branch.

Multiversity

This guide is a part of the Multiversity initiative. The aim is to have high quality open source tutorials along with screencasts.

Contributing

We welcome all Pull Requests, please raise an issue before starting your work!

Backstory

I got feedback from a reddit user that maybe it is too early for me to start writing this book. Decades ago, a young student from the University of Helsinki had an endless debate with Andrew Tannenbaum on comp.minix. It was about monolithic kernels. Had the student listened to Andrew Tannenbaum, the world probably would not have had Linux. This is the whole point of open source projects, a little initiative from everyone goes a long way. I would like to thank everyone who gave their suggestions on reddit and HN.

Philosophy

  • Through this book we want to teach how to develop web applications in Go. We expect the reader to know the basics of Go but we assume the reader knows nothing about how to write web applications.
  • The book shall comprise of chapters, if the topic is huge and doesn't fit into one chapter, then we split into multiple chapters, if possible.
  • Each chapter should be split into logical parts or sections with a meaningful title which'll teach the reader something.
  • Every concept should be accompanied by the Go code (if there is any), for sneak peek type sections write the Go pseudo code, writing just the necessary parts of the code and keeping everything else.
  • The code shouldn't be more than 80 characters wide because in the PDF versions of the book the code is invisible.
  • Brevity is the soul of wit, please keep the description as small as possible. This doesn't mean we skip it, but try to explain it in as simple words as possible. In such cases do explain the concept.
  • In the todo list manager which we are creating, we'll strive to implement as much functionality as possible to give a taste of practical Go programming to the reader. In cases where we re-implement stdlib stuff, we should mention it clearly.
  • The main title should have one #, sections should have 2 #'s sub section should have 4 and notes should have 6 #'s (note should have a title too).
  • Multi-line code should use syntax fencing, single line of code can be indented using tabs or by backticks.

Written with love in India with help from the Internet.

License

Book License: CC BY-SA 3.0 License

Note

  1. The Go Programming Basics section has been adapted from build-web-application-with-golang by astaxie Links were updated to refer the correct aspects of the current book, titles were updated to fit into this book. Modifications to the content was done to suit to the style of the book.
  2. The gopher in the cover page is taken from https://golang.org/doc/gopher/appenginegophercolor.jpg without modifications.
  3. The chapter on database is adapted from https://github.com/VividCortex/go-database-sql-tutorial/ with modifications.

Links

Issues
  • Update header levels/spacing

    Update header levels/spacing

    Purpose

    Update header levels and immediate spacing around them.

    Why

    As I read through the book I noticed that formatting was off in places, often when code ran up against headers or other blocks of content. I also noticed that some header levels appeared "off".

    This PR is focused specifically on the header levels with follow-up PRs for other indirectly related formatting issues.

    fixes #105

    bug formatting 
    opened by atc0005 20
  • Overall Editorial Theme

    Overall Editorial Theme

    Hi @brudgers I missed out on your comment on my HN post, and now there is no way to contact you. The editorial theme I have mentioned in the readme document here, is there more information required on that?

    What prompted writing this book:

    While learning web dev with Go it was very difficult to understand real life examples, most of all the tutorials/books I read gave some ridiculously simple examples and then somehow expect the total newbie to understand all the complicated logic that goes with an actual real life webapp.

    Also PRs are welcome!

    opened by thewhitetulip 8
  • Why not use ParseGlob in the templates example?

    Why not use ParseGlob in the templates example?

    Seems like this code in the templates example is just reproducing the ParseGlob method:

    Reading template:
    
            templates, err = template.ParseFiles(allFiles...)
            
    Where allFiles is populated as below:
    
            var allFiles []string
            templatesDir := "./public/templates/"
            files, err := ioutil.ReadDir(templatesDir)
            if err != nil {
                fmt.Println("Error reading template dir")
            }
            for _, file := range files {
                filename := file.Name()
                if strings.HasSuffix(filename, ".html") {
                    allFiles = append(allFiles, templatesDir+filename)
                }
            }
            

    For example, in my program this is the exact code:

    var tmplDir = "/home/ben/projects/bagapp2/tmpl/"
    
    var templates = template.Must(template.ParseGlob(tmplDir + "*.html"))
    
    opened by benkasminbullock 7
  • Some header levels are inconsistent, spacing off

    Some header levels are inconsistent, spacing off

    Some headers jump sequence, others have inconsistent spacing around them which (I vaguely recall) interferes with some rendering.

    Going to reference this issue for an upcoming PR, potential further discussion.

    bug formatting 
    opened by atc0005 5
  • A package with example code

    A package with example code

    I couldn't find where the examples code is, as I am interested to contribute the code and tests too. So maybe you should add a subdirectory named examples so all the examples code can be there.

    or if you have it somewhere else please let know.

    PS: I was about to write a book in my local language( swahili, I'm from tanzania), now I don't think it is necessary. Will instead contribute to this one so maybe in the future I will just need to translate this.

    opened by gernest 5
  • How do you generate new ebooks from content in this repo?

    How do you generate new ebooks from content in this repo?

    First of all, many thanks for providing both the book and the source files used to produce the book. I'm a newbie to Go and have found the book very helpful as a companion to some other books I'm working through, though it is without a doubt very useful all on its own.

    As I work through the material, I've found some minor issues, several of which have been reported and fixed by Pull Requests submitted by others (e.g., #92). I've got some others that I wish to submit, but I'd like to test the changes by generating fresh ebooks for comparison, either before submitting PRs or just after to proof the work.

    I suspect that perhaps you're using pandoc, but wanted to touch base and confirm before I went in that direction.

    Thanks in advance for your help.

    opened by atc0005 4
  • Typo?

    Typo?

    In chapter: 2.0implementationBasics.md,

    We take a sub string of the URL and remove the /delete/ part and we have the ID of the task.

    but the code above we strip the /tasks/ actually, is this a typo?

    opened by rongyi 4
  • about braces and indentation wars

    about braces and indentation wars

    Hi, The write up about Go curly brackets syntax and indentation wars might need changes in https://github.com/thewhitetulip/web-dev-golang-anti-textbook/blob/master/content/02.1.md

    The fact that go cannot have opening curly bracket at the beginning of the line is an "unintended consequence" of doing away with semicolons

    see Rob Pike's talk about braces here https://youtu.be/VoS7DsT1rdM?t=1353

    opened by emelens 4
  • Remove Links section at the bottom of most chapters?

    Remove Links section at the bottom of most chapters?

    Example from a preview PDF copy:

    antitextbook-footer-links-sections-with-broken-links

    I'm proposing that we remove these sections if they don't contain any external "See also" style external links (e.g., those intended to provide more information/context).

    formatting 
    opened by atc0005 3
  • How do you prefer pull requests to be constructed?

    How do you prefer pull requests to be constructed?

    @thewhitetulip

    As an example, if there are header level changes, typos and spacing adjustments, do you want them combined into fewer PRs or more focused on a specific type of change?

    If combined, would you find it helpful to have multiple commits per PR (e.g., one file per commit with all changes to that file) or squashed to one commit containing all changes?

    I've got some notes from going through the text (only the first pass at reading as I have much to learn from your book) and would like to begin compiling the changes into acceptable PRs. I figure I would touch base and confirm some details before investing too much work into the effort just yet.

    Thanks.

    question 
    opened by atc0005 3
  • Multiple headers not rendering properly

    Multiple headers not rendering properly

    I noticed that while reading the epub version the level 2 header for Constants was rendered as ## Constants, literally within the text instead of a formatted header as intended. I double-checked and the 2018-06-09 version available from leanup has the same issue in the PDF format also.

    Attaching a screenshot for illustration. constants_header_not_rendering_properly_2019-06-16

    I briefly looked over the source Markdown file, but I can't tell for sure if the issue has been addressed since the 2018-06-09 version was released.

    opened by atc0005 3
  • Error with command go install github.com/mohamedmehdigara/hello@latest

    Error with command go install github.com/mohamedmehdigara/[email protected]

    Error msg: go install github.com/mohamedmehdigara/[email protected]: no matching versions for query "latest"

    because this command: go install github.com/mohamedmehdigara/hello

    gave the following error msg: go install: version is required when current directory is not in a module Try 'go install github.com/mohamedmehdigara/[email protected]' to install the latest version

    opened by mohamedmehdigara 0
  • Parameterized routing, misleading comment

    Parameterized routing, misleading comment

    If we look at Parameterised routing, within the Basic web application section. I believe this comment is misleading. While it may be used later to retrieve the task id and delete, this is not the case here.

    opened by shan33k 1
  • runtime.Gosched usage is likely to lead readers astray

    runtime.Gosched usage is likely to lead readers astray

    While this might well be the shortest way you found to demonstrate the output you wanted, training users toward this function stands a good chance of them trying to use it to solve early problems it is not suitable for.

    opened by raggi 4
Owner
Suraj Patil
Go, Python, Statistical Learning
Suraj Patil
Boilerplate for writing Go applications without framework using hexagonal application development approach

Boilerplate for writing Go applications without framework using hexagonal application development approach

Marko Kovačević 25 May 5, 2022
7 days golang programs from scratch (web framework Gee, distributed cache GeeCache, object relational mapping ORM framework GeeORM, rpc framework GeeRPC etc) 7天用Go动手写/从零实现系列

7 days golang programs from scratch README 中文版本 7天用Go从零实现系列 7天能写什么呢?类似 gin 的 web 框架?类似 groupcache 的分布式缓存?或者一个简单的 Python 解释器?希望这个仓库能给你答案

Dai Jie 10.7k Jun 26, 2022
Introduction to beginners learn to go

For-learning-Go-Tutorial 准备写一本Go的书针对初学者快速入门开发和使用go! 学习Go语言需要去了解Go的特性,然后在深入的去实践,如果你想使用Go语言写出Go味道的程序,那么你就需要付出努力去实践了! 先来了解下Go语言为何创造出来的历史吧,Go 语言是由谷歌公司在 20

keke 549 Jun 17, 2022
Building a shoe store with golang to learn more about this language :)

shoestore-go Building a shoe store with golang to learn more about this language :) TODO Create a basic webpage with the pages: home : to show homepag

Bruno B. Melo 4 Jan 24, 2022
The purpose of this project is to learn about go-swagger.

learn-go-swagger The purpose of this project is to learn about go-swagger. Requirements Go go-swagger Setup Run ./scripts/gen-swagger to generate swag

Henrik Christensen 0 Nov 20, 2021
A repository for showcasing my knowledge of the Google Go (2009) programming language, and continuing to learn the language.

Learning Google Golang (programming language) Not to be confused with the Go! programming language by Francis McCabe I don't know very much about the

Sean P. Myrick V19.1.7.2 1 Nov 26, 2021
A repository for showcasing my knowledge of the Go! (2003) programming language, and continuing to learn the language.

Learning Go! (programming language) Not to be confused with Google Golang (2009) I don't know too much about the Go! programming language, but I know

Sean P. Myrick V19.1.7.2 1 Nov 26, 2021
Перевод книги «Learn Go with Tests» на русский язык.

Изучите Go через тестирование Обложка нарисована Denise Форматы для чтения Gitbook EPUB or PDF Доступные переводы English 中文 Português 日本語 한국어 Türkçe

Daniil Maslov 0 Dec 9, 2021
A series of small code snipppets & exercises to learn Go.

Learning-Go A series of small code snipppets & exercises to learn Go. WARNING: During this excercise you will be learning along with me, I am not your

Elemental X 1 Dec 18, 2021
Learn the Go programming language (Golang) in this step-by-step tutorial course for beginners

Learn the Go programming language (Golang) in this step-by-step tutorial course for beginners. Go is an open source programming language designed at Google that makes it easy to build simple, reliable, and efficient software.

Burak Tokman 1 Dec 16, 2021
Learn Golang in-depth by solving 15 Quizzes, 10 Exercises and 4 Projects

Modern Go (Golang) - The Complete Beginners Guide 2021 Learn Go (Golang) in-dept

Classroooms 2 May 30, 2022
At this example project, I'm trying to learn Golang with Clean structure and come up with a reusable

Learning Golang Language In Clean Structure At this example project, I'm trying to learn Golang with Clean structure and come up with a reusable, nice

GoTorn 5 Jun 21, 2022
Golang tutorials - a self-project to learn Go.

Golang Tutorials a self-project to learn Go. prod by blvnk. Tech With Tim Tutorials Intro to Go created a Hello World program. compiled a Hello World

adore_blvnk 0 Feb 21, 2022
Rps-game-in-go - Learn Go for Beginners Crash Course (Golang)

rps-game-in-go This rock-paper-scissors game was based on the Udemy course "Lear

Mark Yen 0 Mar 20, 2022
roguelike tutorial in Go using the framework gruid

Gruid Go Roguelike Tutorial This tutorial follows the overall structure of the TCOD Python Tutorial, but makes use of the Go programming language and

null 12 Apr 16, 2022
📁 Examples for 🚀 Fiber - Express inspired web framework written in Go

?? Examples for ?? Fiber - Express inspired web framework written in Go

Fiber 1.6k Jun 28, 2022
This project is a GO Restful API service with Gin framework and Gorm SQLite with authorization

GO Restful API service with Gin framework and Gorm SQLite Template Structure Gin is a web framework written in Go (Golang). It features a martini-like

Thanakorn Ariyagusolsuthi 1 Mar 24, 2022
Forms814 - A website builder, useful for writing data collection webapps quickly.

forms814 A website builder, useful for writing data collection webapps quickly. Project Design The method in use here is to mix it with complicated fo

Bankole Ojo 1 May 24, 2022
Learn-Nakama - An example project template on how to set up and write custom logic in Nakama server

Nakama Project Template An example project template on how to set up and write c

Hartawan Bahari M. 2 Apr 18, 2022
Write controller-runtime based k8s controllers that read/write to git, not k8s

Git Backed Controller The basic idea is to write a k8s controller that runs against git and not k8s apiserver. So the controller is reading and writin

Darren Shepherd 50 Dec 10, 2021
onnx-go gives the ability to import a pre-trained neural network within Go without being linked to a framework or library.

This is a Go Interface to Open Neural Network Exchange (ONNX). Overview onnx-go contains primitives to decode a onnx binary model into a computation b

Olivier Wulveryck 399 Jun 22, 2022
Boilerplate for writing Go applications without framework using hexagonal application development approach

Boilerplate for writing Go applications without framework using hexagonal application development approach

Marko Kovačević 25 May 5, 2022
Goal: Develop a Go start auth starter without Gin framework

Goal: Develop a Go start auth starter without Gin framework and learn along the

Kai Hendry 2 Feb 1, 2022
How to get a Go / Golang app using the Gin web framework running natively on Windows Azure App Service WITHOUT using a Docker container

Go on Azure App Service View the running app -> https://go-azure-appservice.azurewebsites.net ?? This is an example repo of how to get a Go / Golang a

Ed Andersen 4 Jun 24, 2022
7 days golang programs from scratch (web framework Gee, distributed cache GeeCache, object relational mapping ORM framework GeeORM, rpc framework GeeRPC etc) 7天用Go动手写/从零实现系列

7 days golang programs from scratch README 中文版本 7天用Go从零实现系列 7天能写什么呢?类似 gin 的 web 框架?类似 groupcache 的分布式缓存?或者一个简单的 Python 解释器?希望这个仓库能给你答案

Dai Jie 10.7k Jun 26, 2022
keep track of things you learn / discover everyday!

?? Personal Archive Personal-Archive keeps track of things you learn / discover everyday! ?? Why I face tons of articles every day. Via googling or RS

Lee Jaeyong 31 May 23, 2022
Learn Go with test-driven development

Learn Go with Tests Art by Denise Formats Gitbook EPUB or PDF Translations 中文 Português 日本語 한국어 Support me I am proud to offer this resource for free,

Chris James 17.8k Jun 28, 2022
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

English ∙ 日本語 ∙ 简体中文 ∙ 繁體中文 | العَرَبِيَّة‎ ∙ বাংলা ∙ Português do Brasil ∙ Deutsch ∙ ελληνικά ∙ עברית ∙ Italiano ∙ 한국어 ∙ فارسی ∙ Polski ∙ русский язы

Donne Martin 185.2k Jun 29, 2022
Introduction to beginners learn to go

For-learning-Go-Tutorial 准备写一本Go的书针对初学者快速入门开发和使用go! 学习Go语言需要去了解Go的特性,然后在深入的去实践,如果你想使用Go语言写出Go味道的程序,那么你就需要付出努力去实践了! 先来了解下Go语言为何创造出来的历史吧,Go 语言是由谷歌公司在 20

keke 549 Jun 17, 2022