fredericrous / golibs

Golang libraries I use across my Go projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golibs

Golang libraries I use across my projects

Build status GitHub last commit GitHub commit activity GitHub issues

Setup

Simply import one of the following libraries in your Go code:

  • "github.com/qdm12/golibs/admin" for supervising your application, it contains a Gotify client
  • "github.com/qdm12/golibs/command" for interacting the shell command line
  • "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/network" for HTTP requests, IP address processing and connectivity checks
  • "github.com/qdm12/golibs/os" for OS related operations like file manipulation.
  • "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.

Development

  1. Setup your environment

    Using VSCode and Docker (easier)

    1. 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
    2. With Visual Studio Code, install the remote containers extension
    3. In Visual Studio Code, press on F1 and select Remote-Containers: Open Folder in Container...
    4. Your dev environment is ready to go!... and it's running in a container 👍 So you can discard it and update it easily!

    Locally

    1. Install Go, Docker and Git

    2. Install Go dependencies with

      go mod download
    3. Install golangci-lint

    4. You might want to use an editor such as Visual Studio Code with the Go extension. Working settings are already in .vscode/settings.json.

  2. 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 .
  3. See Contributing for more information on how to contribute to this repository.

TODOs

  • HTTP server/client unit tests
  • Server rework to write unique request ID (see timesheet)
  • More hashing functions

License

This repository is under an MIT license

About

Golang libraries I use across my Go projects

License:MIT License


Languages

Language:Go 99.7%Language:Dockerfile 0.3%