Description
In this course, you will learn :
- Why Go is an excellent language for writing command-line programmes.
- How to organise your Go programmes.
- What is the best way to write idiomatic Go code?
- How to test your programmes and impress your users, peers, and managers
- To keep the course as practical as possible, the emphasis is on command-line programmes, but the majority of the principles and best practises you will learn apply to any Go programme.
Syllabus :
1. Overview
- What's a Command-Line Program?
- Why Go?
- Lightning Quick Introduction to Go
- Ten Popular Go Projects
- Introducing Multi-git 0.1
- Analyzing Multi-git 0.1
- Improving Multi-git
2. Restructuring multi-git
- The foundations of a Go Program
- Creating the Directory Structure
- Refactoring the Core Logic
- Adding a Helpers Package
- Refactoring the Command-Line interface
3. Testing
- Introducing the Built-in Go Testing Support
- Running Go Tests
- Checking Test Coverage
- Quick introduction to Ginkgo and Gomega
- Writing BDD Tests for Multi-git
- Running Unit Tests for Multi-git
- Preparing for End-to-End Tests
- Building the Foundation for End to End Tests
- Writing End-to-End Tests
- Running End-to-End Tests
- Debugging With Tests
4. Adding Smart Command-Line Parsing
- Introduction to Cobra
- Comparing Cobra to Alternatives
- Working with Cobra - The Root Command
- Working with Cobra - The Sub-commands
- Working with Cobra - Flags
- Understanding the Cobra Generator
- Creating an Application Skeleton With the Cobra Generator
- Adding Commands With the Cobra Generator
- Building the Application on Top of the Skeleton
- Finalizing the Cobra-generated Application
- Refactoring Multi-git to use Cobra - The Plan
- Refactoring Multi-git to use Cobra - The Root Command
- Finalizing the Integration of Cobra into Multi-git
5. Adding Advanced Configuration
- Understanding Program Configuration
- Taking Advantage of Sophisticated Configuration
- Introduction to Viper
- Viper and Environment Variables
- Locating Configuration Files
- Reading and Writing Configuration Files
- Watching Configuration Files
- Understanding Remote Configuration
- Dynamic Remote Configuration with Viper
- Understanding the Synergy Between Cobra and Viper
- Integrating Cobra and Viper
- Refactoring Multi-git to use Viper
- Adding a Configuration File to Multi-git
6. Adding Bells and Whistles
- Understanding the Go Build Process
- Building Go Packages
- Linking Go Programs
- Embedding Data Into Go Programs
- Introduction to Self-Updating Programs and GitHub Actions
- Making a CI/CD Pipeline for multi-git
- Creating GitHub Releases for Multi-git
- Transforming multi-git to a Self-Updateable Program
- Introduction to Containers and Docker
- Using a multi-Stage Dockerfile
- Dockerizing multi-git
- Introduction to Makefiles
- Adding a Makefile for Multi-git