Skip to content

sentenz/percent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Percent

GoDoc Go Report Card License

Percent is a Go package that provides utility functions for calculating percentages and performing related operations.

1. Details

1.1. Prerequisites

  • Go

    Go programming language environment for building and running Go applications.

  • Make

    Task automation tool to manage build processes and workflows.

  • Docker

    Containerization tool to run applications in isolated container environments and execute container-based tasks.

1.2. Installation

Install the package via go get.

go get github.com/sentenz/percent

Import the package in a called Go source file.

import "github.com/sentenz/percent/pkg/percent"

2. Usage

2.1. Bootstrap

A bootstrap script initializes an environment, application, or system by installing dependencies, configuring settings, or preparing the system for further operations.

  • scripts/

    Collection of bootstrap, setup, or teardown scripts across multiple environments.

2.2. Dev Containers

A Development Container (Dev Container) utilizes a container as a full-featured development environment.

  • .devcontainer/

    Collection of Dev Container resources published under mcr.microsoft.com/devcontainers.

2.3. Task Runner

2.3.1. Make

  • Makefile

    A Makefile is used to define and manage tasks for building, testing, and maintaining the project.

    [!NOTE]

    • Run the make help command in the terminal to list the tasks used for the project.
    • Targets must have a leading comment line starting with ## to be included in the task list.
    $ make help
    
    Tasks
            A collection of tasks used in the current project.
    
    Usage
            make <task>
    
            bootstrap                   Initialize a software development workspace with requisites
            setup                       Install and configure all dependencies essential for development
            teardown                    Remove development artifacts and restore the host to its pre-setup state
            go-test-unit                Run Go unit tests with race detection
            go-test-coverage            Run Go tests with coverage report
            go-test-bench               Run Go benchmarks
            go-test-fuzz                Run fuzz tests
            go-check                    Run all Go code quality checks
            secrets-sops-encrypt        Encrypt file using SOPS
            secrets-sops-decrypt        Decrypt file using SOPS
            analysis-policy-conftest    Analyze configuration files using Conftest for policy violations and generate a report
            analysis-lint-regal         Lint Rego policies using Regal and generate a report
    

2.4. Release Manager

2.4.1. Semantic-Release

The Semantic-Release CI/CD Component tool automates release workflows, including determining the next version number, generating a CHANGELOG.md file, and publishing the release notes with artifacts.

  • .gitlab-ci.yml

    include:
      - component: $CI_SERVER_FQDN/development-environment/ci-cd/manager/semantic-release@<version>

2.5. Update Manager

2.5.1. Renovate

The Renovate CI/CD Component automates dependency updates by creating Pull Requests (PRs) or Merge Requests (MRs) to update versions.

  • .gitlab-ci.yml

    include:
      - component: $CI_SERVER_FQDN/development-environment/ci-cd/manager/renovate@<version>

2.6. Secrets Manager

2.6.1. SOPS

  1. GPG Key Pair Generation

    • Task Runner

      Generate a new key pair to be used with SOPS.

      [!NOTE] The UID can be customized via the SECRETS_SOPS_UID variable (defaults to sops-dx).

      make secrets-gpg-generate SECRETS_SOPS_UID=<uid>
  2. GPG Public Key Fingerprint

    • Task Runner

      Print the GPG Public Key fingerprint associated with a given UID.

      make secrets-gpg-show SECRETS_SOPS_UID=<uid>
    • .sops.yaml

      The GPG UID is required for populating in .sops.yaml.

      creation_rules:
        - pgp: "<fingerprint>" # <uid>
  3. SOPS Encrypt/Decrypt

    • Task Runner

      Encrypt/decrypt one or more files in place using SOPS.

      make secrets-sops-encrypt <files>
      make secrets-sops-decrypt <files>

3. References

About

A percentage module for Go.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •