add linting configuration and update logging context key type
Some checks failed
🧪 ✨ Unit Tests Workflow / 🔍 🐹 Go Tests (push) Has been cancelled

This commit is contained in:
2025-06-17 22:03:11 -04:00
parent 68cf45fc49
commit 36518cb902
4 changed files with 60 additions and 2 deletions

39
.gitea/workflows/lint.yml Normal file
View File

@@ -0,0 +1,39 @@
on:
push:
branches:
- "*"
name: 🧪 ✨ Unit Tests Workflow
jobs:
test-go:
env:
GO_VERSION: '1.24.3'
NODE_TLS_REJECT_UNAUTHORIZED: 0
name: 🔍 🐹 Go Tests
runs-on: ubuntu-latest
steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates
run: |
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates
- name: ⚙️ 🐹 Set up Go Environment
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: 📖 🔍 Checkout Repository Code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 📦 📥 Install Dependencies
run: |
go mod download
- name: ✅ 🔍 Run Go Lint
run: |
golangci-lint run ./...

17
.golangci.yml Normal file
View File

@@ -0,0 +1,17 @@
version: "2"
linters:
default: standard
enable:
- whitespace
- tagalign
- reassign
- bodyclose
- contextcheck
- containedctx
- godot
- usestdlibvars
formatters:
settings:
gofmt:
simplify: true

View File

@@ -5,7 +5,10 @@ import (
log "github.com/sirupsen/logrus"
)
const contextKey = "logger"
type contextKeyType string
const contextKey contextKeyType = "logger
const contextKey contextKeyType = "logger"
type Interface interface {
Info(format string, args ...interface{})

View File

@@ -12,7 +12,6 @@ import (
const Version = "0.1"
func main() {
rootCmd := &cobra.Command{
Use: "Go-Template",
Short: "Go-Template is a simple template for Go applications",