# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# README
Torc
How to usage
- cd $GOPATH
- git clone https://github.com/bilalislam/torc.git
import "github.com/bilalislam/torc"
go mod update version
https://medium.com/faun/managing-dependency-and-module-versioning-using-go-modules-c7c6da00787a
Go package management
- Enable go modules from setting go module
- go mod init torc
- go mod tidy for optimize all dependencies Not: By the way this process must for dockerizing of this app
For example;
$ cd root folder
$ go mod init torc
$ go mod tidy
Any more can sharing this package as library
Dockerizing looks like as followings
# Dockerfile Example
# https://medium.com/@petomalina/using-go-mod-download-to-speed-up-golang-docker-builds-707591336888
# Based on this image: https:/hub.docker.com/_/golang/
FROM golang:latest as builder
RUN mkdir -p /go/src/github.com/bilalislam/xxxx
WORKDIR /go/src/github.com/bilalislam/xxxx
RUN git config --global url."https://bilalislam:[email protected]".insteadOf "https://github.com"
# Force the go compiler to use modules
ENV GO111MODULE on
# <- COPY go.mod and go.sum files to the workspace
COPY go.mod .
COPY go.sum .
# Get dependancies - will also be cached if we won't change mod/sum
RUN go mod download
# COPY the source code as the last step
COPY . .
# Compile application
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o basket-updated
RUN chmod +x /go/src/github.com/eshop-consumers/xxxx
#Image Diff
#(Not Scratch) 1.23GB
#(Scratch ) 34.3MB
# <- Second step to build minimal image
FROM scratch
WORKDIR /root/
COPY --from=builder /go/src/github.com/bilalislam/xxxx .
ENV ENV_FILE qa
# Execite application when container is started
CMD ["./basket-updated"]
EXPOSE 8080
Amqp wrapper package
let look at https://github.com/emretiryaki as github account
Generic repository for db
-
basic implementation
-
bridge patter implementation
Http Client
client := p.Client.NewRequest()
request := client.Get("/path")
request.AppendHeader("header-key", "header-value")
var build = request.BuildRequest()
var response interface{}
err := build.Call(&response)
How to mocking in golang
- https://github.com/vektra/mockery
- all tests targeted %100 coverage but some cases could not be mocking
- how do it that ignore coverage for unnecessary classes in golang