Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hello all,

After 2.5 years of writing, countless weekends and evenings, I released a book about the Go programming language.

The book is available for free on the website because I wanted to give something back to the developer's community :)

It is composed of 700+ pages, 41 chapters, and approximately 405 drawings/screenshots.

I tried to cover all the important topics that a new Go programmer should know.

At the end of each chapter, you can find a small Q/A and a bullet point list of key notions.

I would love to hear your feedback about it!



Thank you for this fantastic resource. I've been meaning to learn Go for a while, but have a lot of difficulty staying focused on tutorials with big blocks of text. Your concise bullet format is really easy to follow, and would be especially useful for anyone who doesn't speak English as their first language.

Also really respect that you clearly did this out of passion, so I'll say this to everyone on your behalf: support the author by purchasing a digital copy!

https://www.practical-go-lessons.com/buy-digital-or-hard-cop...


oh thank you! I appreciate your kind words:) It's very rewarding to read all the comments on this thread... You made my day !


Man I been looking at diving into Go for a while now, time to go in headfirst. Really appreciate your contribution and I feel the exact same way about wanting to give back to the community, one day I'll have something of value to offer!


Thank you jackosdev !

Maybe you can begin by blog posts ? It is a good exercice to dive deep into a subject and make sure you understand it. Do not hesitate to contact me if you want support in the process


Hi, Maximilien. I really like the structure of the books. It starts with "what we will learn" and ends with "test yourself" and key takeaways. The structure can help the reader to really conscious in understanding the learning goals and validating the understanding.

I also always want to write a programming language book or some other technical topic book in general, which the writing process will I use as learning process for myself. But I always wonder in deciding the topic to cover. How do you decide the topics to cover? Do you start from following existing books or online documentation topic sequences? Or just write whatever topic you are interested first and structure the content afterward?


Thanks for your comment ! If you want to do it, just pick a language and start to write.

Writing is not easy but it becomes easier if you transform it into a habit.

In my experience I forced myself to write regularly like every day of the week. I usually worked one hour approximately by session.

By doing so you will see that you will achieve a lot.

Do not force youtself to write for one entire day then do nothing for a week.

Concerning the topics to cover I will recommand using a mind map to build the table of content. This is interesting because you can drag and drop sections easilly.

I would suggest first to define your targeted audience. Having this audience you can begin building the plan.

My approach was to teach notions progressively. Sometime I needed to rework the sections order. Use an editor that allow you to do that easilly like Lyx (love it).

Students generally love rituals and adding some introduction ritual/section and conclusion section is a plus.

Hope those recommendations will help you :)

Writing something is really a great way to make sure you understand something !

Good luck


This looks amazing. Thank you.

I've found an error.

In Chapter 6, Section 3 (Introduction) you say, "In a previous chapter, we covered decimal and binary notation." but those topics aren't covered until Chapter 7 :)


Thanks for spotting this, I will add it to my todo.


I really like that you go in detail of common and important standard library functions and hit come important things like database drivers and JSON. 700 pages is a nice big programming book and it looks like you're not skimping on details. Great job and good work!


Hello jjice,

Thanks for those kind words, I tried to cover a lot of topics. Consequently it makes a lot of pages!

I hope that the content will help you ! Do not hesitate to contact me if you spotted an error or if you want to suggest an improvement.


Can you help me understand this code on interfaces? If you were calling (CartStore.GetById()) where does (*cart.Cart) come from? I don't see any logical connection between these two.

  type Cart interface {
      GetById(ID string) (*cart.Cart, error)
      Put(cart *cart.Cart) (*cart.Cart, error)
  }

  // A type that implements the interface :

  type CartStore struct{}

  func (c *CartStore) GetById(ID string) (*cart.Cart, error) {
      // implement me
  }

  func (c *CartStore) Put(cart *cart.Cart) (\*cart.Cart, error){
      // implement me
  }


Hello rustyboy, first thanks for your feedback.

I think that there is a mistake in the name of the interface type. It should not be `Cart` but something else. Like `CartStorage`.

A type that implement this CartStorage interface can be named `MySQLCartStorage` or `DynamoDBCartStorage`. Each database engine responsible for the storage will have a different implementation.

The interface is here to define a contract, a set of behaviors that you should implement.

I will definitely change that


Let me just clarify, sorry i'm from python, so not very familiar but this feels like a "circular reference". You're implementing a struct CartStore which has methods GetById, and Put. Because interfaces (or contracts) are implicit then it's automatically considered a Cart.

What I don't understand is the return types of these functions, a pointer to a cart's cart member? or an error.


Interfaces in Go are implicitely implemented. It means that if a type has the methods defined in the interface, then it implements the interface.

I will update the example because it's confusing !

If you have some time come to the speak with me in the chatbox on the website I can help you understand this.


  cart.Cart
  package.NameInPackage
So the name Cart is an interface, the function/method signatures are indicating that a Cart is being returned but being explicit about the package the interface belongs to with cart.Cart. It's made more confusing since the name cart (lower-c) is being used for both a member variable and the package name in the signature of Put, and it looks like the package name doesn't show up on an explicit line in that chapter to help clarify it.


One feedback: I skimmed through the Context chapter and noticed that you made the common mistake.

In the code snippet provided at https://www.practical-go-lessons.com/chap-37-context#the-ser..., you made the channel unbuffered. The doWork goroutine would write to the channel and the "main" goroutine would read from it. But since the "main" goroutine could exit early because of context cancellation, they could get into the case of no one on the reading end any more, causing the doWork goroutine to be blocked forever (the writing to the channel is blocked when there's no one to read it).

Someone even published a paper about fixing this common mistake in open source projects a few days ago: https://www.reddit.com/r/golang/comments/m66djp/automaticall...


I think this is very well structured. I really like the "Test yourself" section. As a person who finds small post-reading assignments enjoyable and motivating, my only suggestion would be to add a small assignment that employs the learnings. Actually coding what one just learned is arguably a good way to reinforce the learnings and raising further questions/doubts. E.g. for your Application Configuration chapter, an example assignment could be:

    Create a command line application that accepts users inputs as below:

        a. Mandatory "-firstName" flag to accept first name
        b. Mandatory "-lastName" flag to accept last name
        c. Optional "-middleName" flag to accept middle name
        d. Mandatory "-age" flag to accept age - only integers between 0 and 200 should be accepted
        e. Optional "-party" flag to accept political party following - only valid values are "D", "R" and "I"
        d. Optional "-userId" flag to specify user id - if HOME environment variable is set, extract user id from home directory path


A very minor point (sorry): please could you search-and-replace all “advices” to “advice” in the text? Advice is its own plural form.


Thanks for your feedback added to my todo list !


I just pushed a new release with that fix


I love it. Hats off to you for your hard work on this. Who builds your illustrations/graphics ? Looks cool.


My spouse :)

Thank you for your feedback !


At this point any Go-related work must come with illustrations done by the spouse.


Should probably credit them in the foreward.


Love the book! I think there's a small typo on https://www.practical-go-lessons.com/chap-41-cheatsheet, 2 Slices: "A good resource for playing with maps is https://github.com/golang/go/wiki/SliceTricks". I think you meant slices instead of maps?


This is great,well done! I was thinking of picking Go at some point this year, need not to forget to buy the book. May I ask what did you for the website,looks pretty neat?


Thank you for your feedback and support!

Go is easy to learn, and you need a limited amount of time to produce code!

I built the website with VueJS, and I use bootstrap for the CSS part (with https://bootstrap-vue.org/).


Great book! (and this from someone who does not like Go :)). After reading a bit I was almost ready to jump in again and then I remembered errors and the associate repeating code and I got back to Python.

I have a friend who is constantly trying to drag me though the fence so maybe one day.

You may want to try quasar (https://quasar.dev/) for your VueJS sites - it is excellent.


Thank you ! I hope this day is close !

I will try quasar on another project maybe, I did not know this framework. I also need to improve my competences with React :)


Thank you for your work. I absolutely love the book. You might add links to buy digital copy at the very top of the page. Currently, I've found the link on 3rd attempt) Also, why not sell on Gumroad (https://gumroad.com)? It is convenient. Good luck!


Not a Go programmer and usually don't post here. Just wanted to appreciate the effort, also saving it for future reference. Thanks


great ! see you soon


On another note, you might want to consider converting the online copy of the book to MkDocs (using the Material theme), so that it's easier to read, navigate and search.

I'd gladly lend a hand with this, if you like?


I like the current design, it is really clean and pleasant to read. I don't like Material Design, kind of makes everything look massive taking up too much space as if my desktop is a phone screen. for ex: http://angular-material.fusetheme.com/ui/forms

Could be that it's just me though



I will take a look at it, thanks for your suggestion. I will check if Lyx has an option to export to this format.


MkDocs isn't a "format" as such. It requires you to write Markdown and then configure the mkdocs.yml file to define the website's properties, such as the navigational structure.


Thanks for this clarification I will check this.


We’ve been moving some docs meant for other teams to mkdocs from Confluence at work and I’ve been happy with it - GitBook is also popular.


This looks great! It looks really well thought out and practical. Congrats on the release. Kudos and thanks for making it freely available as well. Cheers.


Thank you bogomipz !


I can't thank you enough! I wanted to learn Go and wanted something like this. I really like the chapter structure, it really easy to follow and progress.


Thank you very much, I really appreciate :) I hope that it will help you in your Go journey.

Do not hesitate to send me feedback in order for me to improve the content.


Would you consider open sourcing the book? What systems are you using to create and maintain it?


Hello rijoja, I'm currently thinking about it.

I'm writing the book with Lyx. Lyx documents are converted to LaTeX docs, then converted to HTML with pandoc. Then I have a homemade Go script that generates the VueJs components (one per chapter).

This question is asked a lot so I will write something about the system because it can help other writers.


Surprised you didn't use Hugo for your website instead. Since Hugo is written in Go, and it's blazing fast.

Thanks for your work anyhow :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: