Percent is a Go package that provides utility functions for calculating percentages and performing related operations.
- 1. Module
- 2. Contribute
- 3. References
- Go
Go programming language environment for building and running Go applications.
-
Install
Install the package via
go get.go get github.com/sentenz/percent
-
Import
Import the package in a called Go source file.
import "github.com/sentenz/percent/pkg/percent"
-
Examples
Examples of how to use the Percent package.
package main import ( "fmt" "log" "github.com/sentenz/percent/pkg/percent" ) func main() { // Example 1: Calculate what percentage of a value is // What is 25% of 200? result, err := percent.Percent(25, 200.0) if err != nil { log.Fatalf("Error calculating percent: %v", err) } fmt.Printf("25%% of 200 = %.2f\n", result) // Output: 25% of 200 = 50.00 // Example 2: Calculate what percentage a value is of a total // What percentage is 50 of 200? pct, err := percent.Of(50.0, 200.0) if err != nil { log.Fatalf("Error calculating percentage: %v", err) } fmt.Printf("50 is %.2f%% of 200\n", pct) // Output: 50 is 25.00% of 200 }
Contribution guidelines and project management tools.
Make is a automation tool that defines and manages tasks to streamline development workflows.
-
Insights and Details
- Makefile
Makefile defining tasks for building, testing, and managing the project.
- Makefile
-
Usage and Instructions
-
Tasks
make help[!NOTE]
- Each task description must begin 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 - Each task description must begin with
-
scripts/ provides scripts to bootstrap, setup, and teardown a software development workspace with requisites.
-
Insights and Details
-
Initializes a software development workspace with requisites.
-
Installs and configures all dependencies essential for development.
-
Removes development artifacts and restores the host to its pre-setup state.
-
-
Usage and Instructions
-
Tasks
make bootstrap
make setup
make teardown
-
.devcontainer/ provides Dev Containers as a consistent development environment using Docker containers.
-
Insights and Details
-
Dev Container configuration for Go development environment.
// ... "postCreateCommand": "sudo make bootstrap && sudo make setup", // ...
[!NOTE] The
devcontainer.jsonruns thebootstrapandsetuptasks to initialize and configure the development environment.
-
-
Usage and Instructions
-
Tasks
# TODO # make devcontainer-go
-
Go Modules is the dependency management system for Go that simplifies the process of managing dependencies and libraries.
-
Insights and Details
-
Usage and Instructions
-
Tasks
make go-mod-tidy
make go-mod-vendor
-
Go testing is the standard library package for unit testing in Go.
-
Insights and Details
-
testing.TUnit tests use the standard Go testing package with
testing.T. -
Automate unit test generation using Large Language Models (LLMs) Agents.
-
-
Usage and Instructions
-
CI/CD
uses: sentenz/actions/go-tests@latest
-
Tasks
make go-test-unit
-
Go fuzzing is a testing technique that uses randomized inputs to find bugs and security vulnerabilities.
-
Insights and Details
-
testing.FFuzz tests use the standard Go testing package with
testing.F. -
Automate fuzz test generation using Large Language Models (LLMs) Agents.
-
-
Usage and Instructions
-
CI/CD
uses: sentenz/actions/go-tests@latest
-
Tasks
make go-test-fuzz
-
Go benchmarks measure the performance of code and track performance regressions.
-
Insights and Details
-
testing.BBenchmark tests use the standard Go testing package with
testing.B. -
Automate benchmark test generation using Large Language Models (LLMs) Agents.
-
-
Usage and Instructions
-
Tasks
make go-test-bench
-
go tool cover provides code coverage analysis for Go tests.
-
Insights and Details
- Code coverage reports are generated in HTML and XML formats.
-
Usage and Instructions
-
CI/CD
uses: sentenz/actions/go-tests@latest
-
Tasks
make go-test-coverage
-
Semantic-Release automates the release process by analyzing commit messages to determine the next version number, generating changelog and release notes, and publishing the release.
-
Insights and Details
- .releaserc.json
Configuration file for Semantic-Release specifying release rules and plugins.
- .releaserc.json
-
Usage and Instructions
-
CI/CD
uses: sentenz/actions/semantic-release@latest
-
Renovate automates dependency updates by creating merge requests for outdated dependencies, libraries and packages.
-
Insights and Details
- renovate.json
Configuration file for Renovate specifying update rules and schedules.
- renovate.json
-
Usage and Instructions
-
CI/CD
uses: sentenz/actions/renovate@latest
-
Dependabot automates dependency updates by creating pull requests for outdated dependencies, libraries and packages.
-
Insights and Details
- .github/dependabot.yml
Configuration file for Dependabot specifying update rules and schedules.
- .github/dependabot.yml
Conftest is a Policy as Code (PaC) tool to streamline policy management for improved development, security and audit capability.
-
Insights and Details
-
Configuration file for Conftest specifying policy paths and output formats.
-
Directory contains Rego policies for Conftest to enforce best practices and compliance standards.
-
-
Usage and Instructions
-
CI/CD
uses: sentenz/actions/regal@latest
uses: sentenz/actions/conftest@latest
-
Tasks
make policy-lint-regal <filepath>
make policy-analysis-conftest <filepath>
-
Trivy is a comprehensive security scanner for vulnerabilities, misconfigurations, and compliance issues in container images, filesystems, and source code.
-
Insights and Details
-
Configuration file for Trivy specifying scan settings and options.
-
File specifying vulnerabilities to ignore during Trivy scans.
-
-
Usage and Instructions
-
CI/CD
uses: sentenz/actions/trivy@latest
-
Tasks
make sast-trivy-fs <path>
make sast-trivy-sbom-cyclonedx-fs <path>
make sast-trivy-sbom <sbom_path>
make sast-trivy-sbom-license <sbom_path>
-
- GitHub Template DX repository.
- Sentenz Actions repository.
- Sentenz Manager Tools article.