I used a GitHub private repository because I knew I wanted to invite some people that could help from the beginning and give valuable feedback while I was writing the book.
Collaborators can create a pull request and help you get your idea clear while the book gets written. I was writing a chapter and could get some feedback right away before starting the next one. Markdown is very easy to merge pull requests into the master branch.
In December 2017 I started to second guess myself. Am I writing a book? I have no audience, almost no one know me in the Go community. I live 2 hours from Montreal (in the middle of the wood), so I’m not doing any meet-up talks, etc.
And then you stop. Fear, uncertainty, and fear. Some people have those feelings when they are about to launch their product; I never felt that. Excitement, happiness, and relieves are my feelings when launching a product.
To me it was kind of over, I wrote the sample chapter and created a simple landing page. One chapter took me about two months to write, and I had 11 chapters left to write 11 x 2 = 22 months if my math is correct. Discouragement added up to the other feelings.
If you reach a similar position, you probably made the same mistake I did. You’re not talking enough about you writing this book. Tweet about it, blog about it, talk to friends, families, colleagues everywhere you have a chance say you’re writing this book.
One day Dean Layton-James asked me about the book. He was interested in pre-ordering the book because he was starting a project in Go and wanted to double check the progress of my book. He pointed me to some authors that enabled pre-order while they were writing their book. Sometimes it could take up to one year before the book would be ready. Could that be a good path for me?
I was intrigued and decided to try it out. I created the quickest Stripe payment page you can think of, emailed my list, tweet about this announcing that the book was in pre-order starting at $15 and going up at each chapter release.
To my big surprise, this worked. 💥 Ten minutes after emailing my list I already had two sales. The entire day I received new orders. I was excited, happy and energized to continue with the book. From there I wrote about 1 chapter per month with the accompanying source code to the release on September 2018. In continually received new order each time I was releasing a new chapter, it felt really great and kind of validated that there’s a demand for that book.
For the landing page, I used Carrd and Mailchimp to capture email. I was sending the sample chapter via MailChimp’s confirmation email. This work great. People would need to double opt-in to receive the sample chapter.
To capture payment, I created a page with Stripe’s checkout and a quick Go handler to process the payment, send the email with a link to the book zip file. No more than 15 lines of Go code and I was capturing credit card, sending the book and building a csv file of customers that I could use to send downloadable file when new chapter were added.
It was just enough to start. I’ve looked at services like Gumroad and similar, but it did not worked for me, YMMV.
I was sending an email to my list each time a new chapter was released and that the price went up + $2. If I ever write another book, I’ll most certainly re-use this approach. I was able to start taking order for the book in February 2018, 8 months before the book was released.
At first, I used a virtual machine with Ubuntu and Pandoc installed, and then I discovered this helpful docker image that can generate the PDF straight from my Arch Linux machine. Note that I did not wanted to install Pandoc from the Arch repo, the package is huge and install lots of Haskell dependencies and what not. The docker image is perfect. This is how I generate my book.
#!/bin/bash
echo "Generating pdf"
docker run -v `pwd`:/source jagregory/pandoc --listings -H listings-setup.tex -N -S -s -o basaig.pdf title.txt 01.md 02.md 0x.md --epub-cover-image=cover.jpg --toc --latex-engine=xelatex --top-level-division=chapter --base-header-level=1 --highlight-style espresso
echo "Generating epub"
docker run -v `pwd`:/source jagregory/pandoc --listings -H listings-setup.tex -N -S -s -o basaig.epub title.txt 01.md 02.md 0x.md --epub-cover-image=cover.jpg --toc --toc-depth=2 --latex-engine=xelatex
You simply list your markdown files in the order you want your chapters to be generated.
This is the template I use to render the code blocks with the light gray background and the line numbers.
% Contents of listings-setup.tex
\usepackage{xcolor}
\lstset{
basicstyle=\ttfamily,
numbers=left,
numberstyle=\footnotesize,
stepnumber=1,
numbersep=5pt,
backgroundcolor=\color{black!10},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=\textwidth
This render code blocks like this one:
It cannot be easier. Everything is inside clear markdown files. One per chapter. And generating the PDF and ePUB takes less than a couple of seconds.
I’m still trying to figure this one out sorry :). This is the actions I did so far:
/r/golang
in my case to announce the book.In any case, if you’re interested in writing a book or creating an online course but are not sure if you should or think you cannot do it, I’d say just try. I’m a non-native English speaker without an audience, and I did it. It’s hard but doable.