Golang Tutorials

 

Golang related tutorials with the sample project.

@CoderVlogger

YouTube | GitHub | Medium | Twitter

Project Repository

For most of the tutorials, we will use this project as an example. It's an example "search-engine" project with Golang as back-end.

 

Make sure to check the repository, use "Star" and "Watch" to show your support and get the latest updates.

Video1: Introduction

 

Idea, Topics & Project

  • Idea
  • Topics
  • Repository
  • Next: project structure

Content

  • It's a real-world Golang example
  • It's not a course
  • It's not a basics of the language

Idea

Topics

  • REST API in Golang
  • Go with MongoDB / Go with MySQL
  • Unit testing in Golang
  • Using mocks in Go tests
  • Gomock vs. Mockgen within a real project
  • Integration/component testing in Go
  • Go REST API documentation
  • Docker and Docker Compose for Go application
  • Test tool: useful testing commands

Repository

What's next?

  • Set up project structure
  • Example REST API

Video2: Structure

 

Go Application Project Layout.

Video3: Docker

 

Multistage Docker image for Go application.

FROM golang:latest as builder
RUN mkdir /app
WORKDIR /app
COPY . ./
RUN make test
ARG version=dev
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -installsuffix cgo -ldflags "-X main.version=$version" -o kn-be-sd -v ./cmd/sd/main.go

FROM alpine
COPY --from=builder /app/kn-be-sd /

Dockerfile

# 1. Use example repository

#    https://github.com/KenanBek/kn

# 2. Multitage Dockerfile

# 3. Build image with tag name

# 4. Run image and containing application

# 5. Compare size of the final image

Content

Video4: Go Channels

 

Running applications in loop by using Go channels.

In this tutorial video, we review entry point of a web application that runs in loop and react to several input signals by using Go channels.

Additional Resources

Thank You!

Questions or Suggestions?

 

Find me on Twitter and Instagram as @CoderVlogger

Made with Slides.com