This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package number | |
import "golang.org/x/exp/constraints" | |
func Min[T constraints.Ordered](x, y T) T { | |
if x <= y { | |
return x | |
} | |
return y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo Checking Golang outdated dependencies... | |
echo | |
if [ -f "./go.mod" ]; then | |
echo $(head -n 1 ./go.mod) | |
go.exe list -u -m -json all | go-mod-outdated.exe -update -direct | |
else | |
echo " go.mod is missing" | |
fi; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description := "Generic development dependency runner" | |
comma := , | |
ENV ?= dev | |
# You may set credentials for all services with this single session var | |
# Example: | |
# CREDENTIALS=micro-service make postgres | |
# OR under Windows: | |
# wsl CREDENTIALS=micro-service make postgres | |
CREDENTIALS ?= service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model | |
import ( | |
"fmt" | |
"go.mongodb.org/mongo-driver/bson" | |
"go.mongodb.org/mongo-driver/bson/bsontype" | |
"go.mongodb.org/mongo-driver/bson/primitive" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package errcode | |
import ( | |
"fmt" | |
) | |
// Fault type is implementation of standard error interface with minimal details like error scope and error code | |
// and the error scope is a "namespace" of error code used. | |
// Also the Fault type contain Cause field to save original (underlying) error and to support error-wrapping chains. | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"sync" | |
"time" | |
) | |
// Background - abstraction for concurrency scope |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.idea/ | |
.vscode/ | |
.history/ | |
# Debug binaries | |
debug | |
# Binaries for programs and plugins | |
*.exe | |
*.exe~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"some/logging" | |
"also/database" | |
"finally/application" | |
"fmt" | |
"os" | |
) | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package service | |
import ( | |
"fmt" | |
"testing" | |
"github.com/jinzhu/gorm" | |
".../service/model" | |
) | |
type test func(t *testing.T) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// optionsptrn - inspired by https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis | |
package optionsptrn | |
import ( | |
"errors" | |
"time" | |
// ... | |
) | |
// service - to implement SomeInterface. |
NewerOlder