Show HN: I wrote a book about Go
practical-go-lessons.com
practical-go-lessons.com
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 your feedback !
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.
Do not hesitate to send me feedback in order for me to improve the content.
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/).
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.
I will try quasar on another project maybe, I did not know this framework. I also need to improve my competences with React :)
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...
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
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 :)
I'd gladly lend a hand with this, if you like?
Could be that it's just me though
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
}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
What I don't understand is the return types of these functions, a pointer to a cart's cart member? or an error.
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.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?
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
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 pathI'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.
Thanks for your work anyhow :)
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...
Always nice to see more alternative to the Blue Book too ;)
When I open Golang books or any kind of tutorials, I usually jump into Concurrency sections to see its depth and quality ...
If ever start thinking of selling v2 of your book, please go through Katherine Cox-Buday book "Concurrency in Go" content.
I like Katherine but your writing style is much much easy to read and process. Wish half of Katherine content will migrate into your future works.
Adding reference on Katherine book might help others too.
I am really happy that you like the writing style.
I will order the book written by Katherine.
Concurrency is a really difficult topic; maybe I will add more content about it later. Real-world use-cases are hard to find also.
On that one hand the basic steps are there like how to download a specific zip file, but at the same time it goes deep into the different types of profiling and how to use the mandatory tools.
I am not a Go programmer, so I am not your target audience, but I have written a book, so I understand the work.
Thanks so much!
I'm happy that you appreciated my explanations.
Hope it will help somebody in the future
Also I just published this on /r/golang if you do not mind. :)
Thank you for posting this on reddit ! I tried to do it but I made a mistake in the title, so I deleted the post and posted again (I never posted on reddit before). Now it seems that my second post is not really visible.
Thank you for your support Dentrax !
I think that most knowledge gaps we all have are caused by a teacher/book making assumptions about what we already know.
Thank you for the feedback. I tried to make it accessible to new programmers. I hope it will be used by people how wants to start their programmer's journey.
Being a self-taught programmer, I always suffered from not knowing some very basic notions. I learned a lot in the process of writing those chapters.
Category: Malware
That is the warning I'm getting on this link at work. Of course I don't think you are trying to malware people, but might want to look into that on why people might not be able to access your site.
I also checked the website with Google safe browsing (https://transparencyreport.google.com/safe-browsing/search?u...) and the result is also OK. I also run the test with virus total website and no threats have been detected. (https://www.virustotal.com/en/#url).
If you have more information about this do not hesitate to share!
That's probably the reason !
It's probably a combination of young domain, and associated IPs blocked from mail.
Check on Cisco Talos https://talosintelligence.com/ Submit ticket: https://talosintelligence.com/reputation_center/support#repu...
I thought this was a book on writing programs to play Go.
I feel at this point I should use this book to write a program to play Go using Go, and then in a way I wouldn't be so wrong.
I have some feedback, 5.1 Garbage collection, you write "By chance, Go has a garbage collector." Was this really by chance? I don't know think so, it was by design! You even suggest this with your paragraph before explaining what GC is. Consider changing the word "chance" to something like "design" or another word that reflects the concerted choice by the Go authors.
If you find this helpful, let me know and I'd be happy to continue giving you any similar feedback.
One thing I feel is missing, a PDF preview of a few pages so I can see how it looks in the digital edition. Not a huge deal so don't stress about it but I always like to preview ebooks for some reason. I may be alone here tho :)
Really though great work. I am especially impressed at the effort you put into getting a dev environment "up and running" on Windows, Linux and macOS.
I will include maybe the Table of Contents and a couple of chapters.
Also I forgot to say I really appreciate you giving this away for free online. It is clear you put a tremendous amount of time and effort into making this.
Awesome work!
I plan to add more content to the cheatsheet in the future , so stay tuned :)
How'd you build the Web site — a package of some sort, or did you roll your own CSS? I've been working on a law-related book that I plan to post; I like the look of your site.
(I suppose it's too much to hope for that you created this with Emacs and org-mode — which is what I'm writing my book in — together with a nifty CSS package ....)
I wrote it using Lyx which is WYSIWYG for LaTeX. Then I convert the LaTeX document into HTML.
The HTML is then injected (with some modifications) into a Vue component (the website is built with Vue).
I use only Bootstrap for the CSS (with bootstrap-vue). When I have some time I will publish the sources of my script.
I hope it can help you !
What did you use to do the conversion? Will Lyx export HTML, or did you use something else?
Oh the delicious irony. Don't tell Donald Knuth! :)
That said, I’ve got a long ways to go, and I’ve already plowed through six chapters of the book. Nice work!
I'm happy that you like the book
I also plan to write a book about scraping in python and your way of release is more logical for ppl like me.
Like the other guy I also got stuck at TOC. I will use your mind map technique.
Could you open source book releasing tools?
Do not hesitate to share your feedback with me, especially if something is difficult to understand or if you spotted a mistake :)
I think "the first two develop" was meant to be deleted here.
Please, consider reviewing this line, from chapter 5, "I use Goland, which IntelliJ develops". GoLand is developed by JetBrains. IntelliJ IDEA is their Java IDE : )
I appreciate chapter 40 being included, a quick summary of go/programming recommendations. Also the illustration on the landing page caught my eye, good choice.
I will also check Zap to add an example :)
I'll definitely be checking this out. :)
I hope that it will help your niece!
Finding the title was a really hard task. I asked myself existential questions for a couple of days about it. I agree with you it's not perfect.
For the moment you can post your corrections on that URL : https://www.practical-go-lessons.com/feedback
I worte the book using Lyx (https://www.lyx.org/) Each chapter is a Lyx document.
Then I converted : Lyx to LaTeX, then LaTeX doc are converted to HTML with pandoc (https://pandoc.org/).
Then I have an homemade script to generate Vue Components.
Lyx and Pandoc are great tools !
I will highlight some key aspects of my project:
I teach computer science in my free time in a small non-profit organization. Most of the students have no knowledge at all in the field. I wanted to write a book that anybody could use, not only to learn Go but also to learn how to code from the beginning.
I tried to explain every notion by imagining a student with no prior knowledge. I also added content about some key notions like encoding, some basic knowledge about what a computer is made of, what a pointer is ...
I also tried to keep a practical approach, with many examples. I also added a lot of drawings and screenshots. Images are sometimes more efficient than long explanations (this what I learned when I began to teach children).
Keep me updated if you have some time. I would love to hear your feedback ;)
The only warning I got was a Free-Tier limit alert.