Golang libraries I use across my projects
Simply import one of the following libraries in your Go code:
"github.com/qdm12/golibs/command"
for interacting with other subprograms"github.com/qdm12/golibs/connectivity"
for checking for connectivity (DNS resolution, HTTP requests etc.)"github.com/qdm12/golibs/crypto"
for encryption, randomness and checksum functions"github.com/qdm12/golibs/files"
to interact with the filesystem"github.com/qdm12/golibs/format"
to format things to strings"github.com/qdm12/golibs/logging"
for logging functions with a global Zap logger"github.com/qdm12/golibs/params"
for parsing and verifying parameters from environment variables"github.com/qdm12/golibs/redis"
for basic initialization of a Redis database pool of connections"github.com/qdm12/golibs/verification"
for verification functions such as email checking or regex based checking.
For each package, some mocks are generated using mockgen and can be imported with, for example
import github.com/qdm12/golibs/verification/mock_verification
and used with gomock for testing.
-
Setup your environment
Using VSCode and Docker (easier)
- Install Docker
- On Windows, share a drive with Docker Desktop and have the project on that partition
- On OSX, share your project directory with Docker Desktop
- With Visual Studio Code, install the remote containers extension
- In Visual Studio Code, press on
F1
and selectRemote-Containers: Open Folder in Container...
- Your dev environment is ready to go!... and it's running in a container 👍 So you can discard it and update it easily!
Locally
-
Install Go dependencies with
go mod download
-
Install golangci-lint
-
You might want to use an editor such as Visual Studio Code with the Go extension. Working settings are already in .vscode/settings.json.
- Install Docker
-
Commands available:
# Build the binary go build cmd/app/main.go # Test the code go test ./... # Regenerate mocks for tests go generate ./... # Lint the code golangci-lint run # Build the Docker image to run tests and linting docker build .
-
See Contributing for more information on how to contribute to this repository.
- Test ed25519 signatures
- HTTP server/client unit tests
- Server rework to write unique request ID (see timesheet)
This repository is under an MIT license