The modules is contains the golang utilities for internal services

Shared Utility

The modules is contains the golang utilities for internal services.

[[TOC]]

Utilities

  • HTTP Client
  • Errors
  • Validator
    • Basic Validator Rule
    • GRPC Server Interceptor
    • GRPC Client Interceptor (Coming Soon)
  • Logger

Installation

  1. Use the below Go command to install Shared Utility
go get github.com/robowealth-mutual-fund/shared-utility
  1. Import it in your code
import "github.com/robowealth-mutual-fund/shared-utility/httpclient"
import "github.com/robowealth-mutual-fund/shared-utility/errors"
import "github.com/robowealth-mutual-fund/shared-utility/grpcerrors"
import "github.com/robowealth-mutual-fund/shared-utility/validator"

Set up your project to support private modules

Mostly setup command in this instructions base on git.robodev.co (GitLab)

Go

Go version >= 1.13 (RECOMMENDED)

go version # To know your go version

Git

Under the go get command is using Git to pull the specified versions of your dependencies. So, the git configuration for wherever Go is running has to have the appropriate credentials to access any private repositories (In this case is GitLab).

How to get personal access token on GitLab Here

This is great for local development, but what about my CI/CD pipeline?

Dockerfile

Here is an example of a Dockerfile that allows for the injection of credentials at build time.

# ------------------------------------------
#  Base on ROA Microservice's dockerfile
# ------------------------------------------
FROM golang:1.14.1-alpine as dependencies

# Setup ENV (FOR PRIVATE MODULE)

# Install git.
# Git is required for fetching the dependencies.
RUN apk  update  &&  apk  add  --no-cache  git  make  gcc  libc-dev

# Setup Git URL mapping (FOR PRIVATE MODULE)
RUN git config \
--global \
url."https://oauth2:${GITLAB_ACCESS_TOKEN}@git.robodev.co".insteadOf \
"https://git.robodev.co"

# Set the current working directory inside the container
WORKDIR /app

# Copy go mod and sum files
COPY go.mod go.sum ./

# Download all dependencies. Dependencies will be cached if the go.mod and the go.sum files are not changed
RUN  go  mod  download

# Copy the source from the current directory to the working Directory inside the container
COPY  .  .

# Build the Go app
RUN  make  build
# RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/server cmd/**/*.go

# Start a new stage from scratch
# FROM scratch
FROM  alpine

RUN  GRPC_HEALTH_PROBE_VERSION=v0.3.1  && \
wget  -qO/bin/grpc_health_probe  https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64  && \
chmod  +x  /bin/grpc_health_probe

# # Copy the Pre-built binary file from the previous stage. Observe we also copied the .env file
COPY  --from=dependencies  /app/bin/server  /app/bin/server
COPY  --from=dependencies  /app/entrypoint.sh  /

RUN  chmod  +x  /entrypoint.sh

ENTRYPOINT  ["/entrypoint.sh"]
Similar Resources

Msignal - Basic Utilities for OS Signal Management

msignal 📶 - Basic Utilities for OS Signal Management Usage func main() { sysca

Mar 6, 2022

An experimental package that rely on go generics to implement collection functions utilities

go-underscore go-underscore is a utility-belt library for Golang that provides s

Mar 20, 2022

⚡️Lightweight framework for microservices & web services in golang

⚡️Lightweight framework for microservices & web services in golang

Quickstart Zepto is a lightweight framework for the development of microservices & web services in golang. As an opinionated framework, zepto proposes

Jun 19, 2022

webrpc is a schema-driven approach to writing backend services for modern Web apps and networks

webrpc is a schema-driven approach to writing backend services for modern Web apps and networks

webrpc is a schema-driven approach to writing backend servers for the Web. Write your server's api interface in a schema format of RIDL or JSON, and t

Jan 7, 2023

Easily generate gRPC services in Go ⚡️

Easily generate gRPC services in Go ⚡️

Lile is a application generator (think create-react-app, rails new or django startproject) for gRPC services in Go and a set of tools/libraries. The p

Dec 27, 2022

rconn is a multiplatform program for creating generic reverse connections. Lets you consume services that are behind firewall or NAT without opening ports or port-forwarding.

rconn is a multiplatform program for creating generic reverse connections. Lets you consume services that are behind firewall or NAT without opening ports or port-forwarding.

rconn (r[everse] conn[ection]) is a multiplatform program for creating reverse connections. It lets you consume services that are behind NAT and/or fi

Jan 1, 2023

EasyAgent is an infrastructure component, applied to manage the life-cycle of services on the remote host.

EasyAgent is an infrastructure component, applied to manage the life-cycle of services on the remote host.

Easyagent English | 中文 介绍 easyagent是在袋鼠云内部广泛使用的基础架构组件,最佳应用场景包括ELK体系beats等数据采集器的管控和配置管理、数栈体系自动化部署等 基本原理 easyagent主要有sidecar和server两个组件,sidecar部署在主机端,si

Nov 24, 2022

Mortar is a GO framework/library for building gRPC (and REST) web services.

Mortar is a GO framework/library for building gRPC (and REST) web services.

Mortar Mortar is a GO framework/library for building gRPC (and REST) web services. Mortar has out-of-the-box support for configuration, application me

Dec 26, 2022

A TCP proxy used to expose services onto a tailscale network without root. Ideal for container environments.

tailscale-sidecar This is barely tested software, I don't guarantee it works but please make an issue if you use it and find a bug. Pull requests are

Dec 30, 2022
Back end of e-books and papers collection website. Only for internal use.

Back end of e-books and papers collection website. Only for internal use.

Nov 1, 2022
Proof of concept project with MQTT and PLC4X imported as Go modules

portal-connect PoC for a edge MQTT client written in Go Basic project setup with PLC4X and Eclipse Paho How to run Install latest Go version https://g

Jan 19, 2022
The server-pubsub is the main backend of DATAVOC project that manages all the other web-server modules of the same project such as the processor

server-pubsub The server-pubsub is the main backend of DATAVOC project that manages all the other web-server modules of the same project such as the p

Dec 3, 2021
The seed repository for your Flamego middleware modules

seed This repository contains seed files that almost every repository of Flamego middleware module should have. Using the content Create an empty repo

Dec 11, 2021
A base library defines interfaces and modules of aBFT Lachesis consensus protocol

Lachesis base A base library defines interfaces and modules of aBFT Lachesis consensus protocol. Part of galaxy' s Consensus-as-a-Service for distribu

Oct 25, 2021
Package rsync contains a native Go rsync implementation.

gokrazy rsync Package rsync contains a native Go rsync implementation. ⚠ Beware: very fresh. Might eat your data. You have been warned! ⚠ The only com

Jan 2, 2023
Turbine-common - This package contains the common interfaces for Turbine that are shared with other software

turbine-common This package contains the common interfaces for Turbine that are

Feb 12, 2022
This repo contains a sample app exposing a gRPC health endpoint to demo Kubernetes gRPC probes.

This repo contains a sample app exposing a health endpoint by implementing grpc_health_v1. Usecase is to demo the gRPC readiness and liveness probes introduced in Kubernetes 1.23.

Feb 9, 2022
Full-featured BitTorrent client package and utilities

torrent This repository implements BitTorrent-related packages and command-line utilities in Go. The emphasis is on use as a library from other projec

Jan 2, 2023
EU Digital Covid Certificate utilities in Go [Create, Validate and Parse Green-Pass/EU-DCC]

go-dcc EU Digital Covid Certificate utilities in Go [Create, Validate and Parse Green-Pass/EU-DCC] Repo work in-progress CLI Usage: ######Create and S

Dec 23, 2021