Skip to content

Commit ee2b3fd

Browse files
Initial commit
0 parents  commit ee2b3fd

31 files changed

+1029
-0
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
tab_width = 4
8+
9+
[*.go]
10+
indent_style = tab
11+
12+
[Makefile]
13+
indent_style = tab
14+
15+
[*.{yaml,yml}]
16+
indent_size = 2

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5

.github/pull_request_template.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Description
2+
3+
_Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change_
4+
5+
Fixes # (issue)
6+
Dependent # (issue)
7+
## Current status
8+
9+
- [ ] Waiting for review
10+
- [ ] Waiting for comment resolution
11+
- [ ] Waiting for merge
12+
- [ ] Draft
13+
- [ ] Trivial PR (nominal cosmetic/typo/whitespace changes)
14+
15+
## Semantic Versioning
16+
Please delete options that are not relevant. Ensure same has been covered in the commit message as well.
17+
18+
- This is a `fix` change
19+
- This is a `feat` change
20+
- This is a `BREAKING CHANGE`
21+
22+
## Type of change
23+
24+
Please delete options that are not relevant.
25+
26+
- Bug fix (non-breaking change which fixes an issue)
27+
- New feature (non-breaking change which adds functionality)
28+
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
29+
- This change requires a documentation update
30+
31+
## How Has This Been Tested?
32+
33+
_Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration_
34+
35+
### Automated
36+
37+
### Manual
38+
39+
## Checklist:
40+
- [ ] My commit message mentions fix, feat, BREAKING CHANGE accordingly to increase the semantic versioning
41+
- [ ] My code follows the style guidelines of this project
42+
- [ ] I have performed a self-review of my own code
43+
- [ ] I have commented my code, particularly in hard-to-understand areas
44+
- [ ] I have made corresponding changes to the documentation
45+
- [ ] I have checked my code/docs and corrected any misspellings

.github/workflows/SonarCloud.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: SonarCloud
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request_target:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
sonarcloud:
10+
name: SonarCloud
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16+
- name: SonarCloud Scan
17+
uses: SonarSource/sonarcloud-github-action@master
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
20+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/gitleaks.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Gitleaks
2+
3+
on: [pull_request, push, workflow_dispatch]
4+
5+
jobs:
6+
gitleaks:
7+
name: Secret Scan
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Check out the repo
11+
uses: actions/checkout@v2
12+
- name: Run gitleaks
13+
run: docker run -v ${{ github.workspace }}:/path zricethezav/gitleaks:latest detect -v --source="/path" --redact
14+
15+
run-if-failed:
16+
name: Github Security Report (if gitleaks job fails)
17+
runs-on: ubuntu-latest
18+
needs: [gitleaks]
19+
if: always() && (needs.gitleaks.result == 'failure')
20+
permissions:
21+
security-events: write
22+
steps:
23+
- name: Check out the repo
24+
uses: actions/checkout@v2
25+
- name: Generate gitleaks SARIF file
26+
# Exit 0 so we can get the failed report results from this step.
27+
run: docker run -v ${{ github.workspace }}:/path zricethezav/gitleaks:latest detect -v --source="/path" --redact --report-format sarif --report-path="/path/result.sarif" --exit-code=0
28+
- name: Upload SARIF file
29+
uses: github/codeql-action/upload-sarif@v2
30+
with:
31+
# Path to SARIF file relative to the root of the repository
32+
sarif_file: result.sarif
33+
# Optional category for the results
34+
category: secret-analysis

.github/workflows/go-test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Go-Test
2+
on:
3+
[pull_request, push, workflow_dispatch]
4+
5+
jobs:
6+
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Set up Go
13+
uses: actions/setup-go@v2
14+
with:
15+
go-version: 1.18
16+
17+
- name: Test
18+
run: go test -v ./...

.github/workflows/golangci-lint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
pull_request:
5+
permissions:
6+
contents: read
7+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
8+
# pull-requests: read
9+
jobs:
10+
golangci:
11+
name: lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/setup-go@v3
15+
with:
16+
go-version: 1.17
17+
- uses: actions/checkout@v3
18+
- name: golangci-lint
19+
uses: golangci/golangci-lint-action@v3
20+
with:
21+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
22+
version: v1.29
23+
24+
# Optional: working directory, useful for monorepos
25+
# working-directory: somedir
26+
27+
# Optional: golangci-lint command line arguments.
28+
# args: --issues-exit-code=0
29+
30+
# Optional: show only new issues if it's a pull request. The default value is `false`.
31+
# only-new-issues: true
32+
33+
# Optional: if set to true then the all caching functionality will be complete disabled,
34+
# takes precedence over all other caching options.
35+
# skip-cache: true
36+
37+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
38+
# skip-pkg-cache: true
39+
40+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
41+
# skip-build-cache: true

.github/workflows/mkdocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: gen-docs
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- main
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v2
13+
with:
14+
python-version: 3.x
15+
- run: pip install mkdocs-material
16+
- run: mkdocs gh-deploy --force

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
tag:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version:
13+
- 16.x
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Release
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
run: npx semantic-release
23+
goreleaser:
24+
runs-on: ubuntu-latest
25+
needs: tag
26+
steps:
27+
-
28+
name: Checkout
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
-
33+
name: Setup Go
34+
uses: actions/setup-go@v3
35+
with:
36+
go-version: "1.18.0"
37+
-
38+
name: Run GoReleaser
39+
uses: goreleaser/goreleaser-action@v3
40+
with:
41+
# either 'goreleaser' (default) or 'goreleaser-pro'
42+
distribution: goreleaser
43+
version: latest
44+
args: release -f .goreleaser.yaml --rm-dist
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
48+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
bin/

.goreleaser.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
4+
# The project name is used in the name of the Brew formula, archives, etc. If none is given, it will be inferred
5+
# from the name of the GitHub, GitLab, or Gitea release.
6+
# project_name: golang-template-repository
7+
before:
8+
hooks:
9+
# You may remove this if you don't use go modules.
10+
- go mod tidy
11+
# you may remove this if you don't need go generate
12+
- go generate ./...
13+
builds:
14+
- env: [CGO_ENABLED=0]
15+
goos:
16+
- linux
17+
- windows
18+
- darwin
19+
goarch:
20+
- amd64
21+
- arm64
22+
# ID of the build.
23+
# Defaults to the binary name, uncomment line below if needed
24+
# id: "golang-template-repository"
25+
dir: .
26+
main: ./cmd
27+
# uncomment this line to build binary at specific location# Binary name.
28+
# Can be a path (e.g. `bin/app`) to wrap the binary in a directory.
29+
# Default is the name of the project directory.
30+
# binary: ./bin/app
31+
archives:
32+
- replacements:
33+
darwin: Darwin
34+
linux: Linux
35+
windows: Windows
36+
386: i386
37+
amd64: x86_64
38+
checksum:
39+
name_template: 'checksums.txt'
40+
snapshot:
41+
name_template: "{{ incpatch .Version }}-next"
42+
changelog:
43+
sort: asc
44+
filters:
45+
exclude:
46+
- '^docs:'
47+
- '^test:'

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.3.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/golangci/golangci-lint
12+
rev: v1.47.0
13+
hooks:
14+
- id: golangci-lint
15+
- repo: https://github.com/zricethezav/gitleaks
16+
rev: v8.8.12
17+
hooks:
18+
- id: gitleaks
19+
20+
ci:
21+
autofix_commit_msg: |
22+
[pre-commit.ci] auto fixes from pre-commit.com hooks
23+
24+
for more information, see https://pre-commit.ci
25+
autofix_prs: true
26+
autoupdate_branch: ''
27+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
28+
autoupdate_schedule: weekly
29+
skip: []
30+
submodules: false

.releaserc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"ci": true,
6+
"plugins": [
7+
"@semantic-release/commit-analyzer",
8+
"@semantic-release/release-notes-generator",
9+
"@semantic-release/github"
10+
]
11+
}

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM golang:1.18 as build
2+
WORKDIR /go/src/app
3+
COPY . .
4+
# Static build requires CGO_ENABLED=0
5+
RUN mkdir -p /go/bin && CGO_ENABLED=0 go build -ldflags="-w -s" -o /go/bin/app ./...
6+
7+
# Using a distroless image from https://github.com/GoogleContainerTools/distroless
8+
# Image sourced from https://console.cloud.google.com/gcr/images/distroless/global/static
9+
FROM gcr.io/distroless/static:nonroot
10+
COPY --from=build /go/bin/app /
11+
# numeric version of user nonroot:nonroot provided in image
12+
USER 65532:65532
13+
CMD ["/app"]

0 commit comments

Comments
 (0)