You've already forked Go-Template
add linting configuration and update logging context key type
Some checks failed
🧪 ✨ Unit Tests Workflow / 🔍 🐹 Go Tests (push) Has been cancelled
Some checks failed
🧪 ✨ Unit Tests Workflow / 🔍 🐹 Go Tests (push) Has been cancelled
This commit is contained in:
39
.gitea/workflows/lint.yml
Normal file
39
.gitea/workflows/lint.yml
Normal 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
17
.golangci.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
version: "2"
|
||||||
|
linters:
|
||||||
|
default: standard
|
||||||
|
enable:
|
||||||
|
- whitespace
|
||||||
|
- tagalign
|
||||||
|
- reassign
|
||||||
|
- bodyclose
|
||||||
|
- contextcheck
|
||||||
|
- containedctx
|
||||||
|
- godot
|
||||||
|
- usestdlibvars
|
||||||
|
|
||||||
|
formatters:
|
||||||
|
settings:
|
||||||
|
gofmt:
|
||||||
|
simplify: true
|
||||||
@@ -5,7 +5,10 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const contextKey = "logger"
|
type contextKeyType string
|
||||||
|
|
||||||
|
const contextKey contextKeyType = "logger
|
||||||
|
const contextKey contextKeyType = "logger"
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
Info(format string, args ...interface{})
|
Info(format string, args ...interface{})
|
||||||
|
|||||||
1
main.go
1
main.go
@@ -12,7 +12,6 @@ import (
|
|||||||
const Version = "0.1"
|
const Version = "0.1"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
rootCmd := &cobra.Command{
|
rootCmd := &cobra.Command{
|
||||||
Use: "Go-Template",
|
Use: "Go-Template",
|
||||||
Short: "Go-Template is a simple template for Go applications",
|
Short: "Go-Template is a simple template for Go applications",
|
||||||
|
|||||||
Reference in New Issue
Block a user