Skip to content

alvintoh/go-programming-projects

Repository files navigation

Go Programming Projects

Introduction

This repository provides resources for learning Go through project building.

Setup

Windows Dependency Setup

  1. Go

    • Download Go version 1.21.3 from the official download page.

    • Install Go and add C:\Go\bin to your PATH:

      $env:Path += ";C:\Go\bin"
      go version
  2. Docker

    • Download Docker Desktop from the official download page.

    • Install Docker and verify the installation:

      docker version
  3. Chocolatey

    • Install Chocolatey:

      Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  4. Make

    • Install Make using Chocolatey:

      choco install make
  5. Go-Swagger

    • Install go-swagger:

      go install github.com/go-swagger/go-swagger/cmd/swagger@latest
      $env:Path += ";$(go env GOPATH)\bin"
      swagger --version

Remember to reopen PowerShell after each installation to ensure changes take effect.

SQL Database

  1. Run the sql database stack services:

    docker-compose -f deployment/docker-compose/docker-compose-x86.yml --profile sql_database up -d
  2. Login to pgAdmin4 at localhost:5050 (Email: pgadmin4@pgadmin.org, Password: admin).

  3. Create a connection to the existing Postgres database inside the Docker network with the Docker service name:

    • Name: go-programming-network
    • Host: postgres

NoSQL Database

  1. Run the NoSQL database stack services:

    docker-compose -f deployment/docker-compose/docker-compose-x86.yml --profile nosql_database up -d
  2. Login to Mongo Express at localhost:8081 (User: admin, Password: pass).

Note: Mongo databases are created automatically when data is inserted.

Usage

Ensure Go version 1.21.3 is installed.

  1. Create a new service module directory:

    go mod init github.com/your_username/your_repository
  2. Clone one of the following service directories to use as a Go service recommended template for web application:

  3. Go Standard Library

    • go-bookstore
    • go-serverless-yt
  4. Go Fiber

    • go-fiber-crm-basic
    • go-fiber-mongo-hrms
  5. Update application.yml and application-deploy.yml under service-name/resource.

Commands

You can use the following commands under service-name/Makefile for the recommended web applications templates above:

  • make build
  • make run
  • make test
  • make coverage
  • make clean
  • make deploy
  • make destroy

Lambda YT Example

Invoke API:

aws lambda invoke --function-name lambda-yt-example --cli-binary-format raw-in-base64-out --payload '{\"What is your name?\": \"Jim\",\"How old are you?\": 33}' output.txt

Serverless YT Example

Documentation:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published