Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring boilerplate with nanolibs #1

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ root = "."
tmp_dir = "tmp"

[build]
cmd = "CC=gcc CXX=g++ make build"
bin = "bin/boilerplate"
full_bin = "dlv exec --continue --log --listen=0.0.0.0:2345 --allow-non-terminal-interactive --headless=true --api-version=2 --accept-multiclient ./bin/boilerplate -- -env dev"
cmd = "make build"
full_bin = "dlv exec --continue --log --listen=127.0.0.1:2345 --allow-non-terminal-interactive --headless=true --api-version=2 --accept-multiclient ./bin/gofiber-boilerplate"
include_ext = ["go", "yml"]
args_bin = ["--", "serve", "--env", "development", "-p"]
exclude_dir = ["public", "vendor", "log", "tmp"]
exclude_file = ["Dockerfile"]
exclude_regex = ["_test.go"]
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
pull_request:
branches:
- master
- develop
workflow_call:
push:
branches:
- master
- develop
jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--tests=false"
12 changes: 12 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on: [push, pull_request]
name: Security
jobs:
Gosec:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v3
- name: Run Gosec
uses: securego/gosec@master
with:
args: ./...
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'Testing'

on:
workflow_call:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
test:
# TODO: Add redis as service
services: {}
strategy:
matrix:
os: [ ubuntu-latest ]
go: [ 1.19 ]
runs-on: ${{ matrix.os }}
container: golang:1.19-bullseye
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up gotestfmt
run: go install github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
- name: Run tests
run: |
cp config.example.yml config.yml
go test -race -covermode=atomic -coverprofile=coverage.txt -timeout 5m -json -v ./... 2>&1 | gotestfmt
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: tests
name: codecov-umbrella
fail_ci_if_error: true
verbose: true
1 change: 0 additions & 1 deletion .vscode/configurationCache.log

This file was deleted.

5 changes: 0 additions & 5 deletions .vscode/dryrun.log

This file was deleted.

38 changes: 38 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug GoFiberBoilerplate Server",
"type": "go",
"request": "attach",
"mode": "remote",
"remotePath": "${workspaceFolder}",
"port": 2345,
"host": "127.0.0.1"
},
{
"name": "Debug GoFiberBoilerplate",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "main.go",
"args": [
"serve",
"--env",
"development",
"--log-level",
"debug",
"--log-pretty-print"
]
},
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"apiVersion": 2,
"backend": "lldb",
"processId": 0
}
]
}
56 changes: 55 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,57 @@
{
"go.inferGopath": false
"go.inferGopath": false,
"go.testEnvVars": {
"CC": "gcc",
"CXX": "g++"
},
"go.toolsEnvVars": {
"CC": "gcc",
"CXX": "g++"
},
"go.docsTool": "guru",
"go.useLanguageServer": true,
"go.autocompleteUnimportedPackages": true,
"go.gotoSymbol.includeImports": true,
"go.gotoSymbol.includeGoroot": true,
"go.coverOnSave": true,
"go.vetOnSave": "workspace",
"go.coverMode": "atomic",
"go.addTags": {
"tags": "json,bson,yaml",
"promptForTags": true
},
"go.coverageDecorator": {
"type": "gutter",
"coveredHighlightColor": "rgba(64,128,128,0.5)",
"uncoveredHighlightColor": "rgba(128,64,64,0.25)",
"coveredGutterStyle": "blockgreen",
"uncoveredGutterStyle": "blockred"
},
"go.formatTool": "gofumpt",
"go.coverOnSingleTest": true,
"go.coverOnSingleTestFile": true,
"go.coverShowCounts": true,
"go.enableCodeLens": {
"references": true,
"runtest": true
},
"gopls": {
"expandWorkspaceToModule": true,
"experimentalWorkspaceModule": true,
"gofumpt": true,
"build.memoryMode": "Normal"
},
"go.lintTool": "golangci-lint",
"go.toolsManagement.autoUpdate": true,
"go.coverageOptions": "showCoveredCodeOnly",
"go.editorContextMenuCommands": {
"removeTags": true,
"fillStruct": true,
"testFile": true,
"testPackage": true,
"generateTestForFile": true,
"generateTestForPackage": true,
"benchmarkAtCursor": true
},
"go.testExplorer.showDynamicSubtestsInEditor": true,
}
Loading