Skip to content
Closed
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
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
go-version: [ '1.19', '1.20', '1.21', '1.22' ]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-

- name: Download dependencies
run: go mod download

- name: Verify dependencies
run: go mod verify

- name: Build
run: go build -v .

- name: Run go vet
run: go vet .

- name: Run tests
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic .

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.txt
flags: unittests
name: codecov-umbrella
continue-on-error: true

lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest

example:
name: Test Example
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Run CLI example
run: cd examples && go run demo.go
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories
vendor/

# Go workspace file
go.work

# IDE specific files
.idea/
.vscode/
*.swp
*.swo
*~

# OS specific files
.DS_Store
Thumbs.db

# Build artifacts
bin/
dist/
build/

# Coverage files
coverage.txt
coverage.html
*.coverprofile
33 changes: 33 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
linters-settings:
govet:
enable-all: true
gocyclo:
min-complexity: 15
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2

linters:
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
- gofmt
- goimports
- misspell
- revive
- stylecheck

run:
timeout: 5m
tests: true

issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Snider

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
77 changes: 77 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
.PHONY: help build test test-coverage test-bench lint fmt vet clean example example-ui install-tools

# Default target
help:
@echo "Available targets:"
@echo " make build - Build the project"
@echo " make test - Run tests"
@echo " make test-coverage - Run tests with coverage"
@echo " make test-bench - Run benchmark tests"
@echo " make lint - Run golangci-lint"
@echo " make fmt - Format code with gofmt"
@echo " make vet - Run go vet"
@echo " make clean - Clean build artifacts"
@echo " make example - Run the example program (CLI demo)"
@echo " make example-ui - Run the Wails UI example"
@echo " make install-tools - Install development tools"

# Build the project
build:
@echo "Building..."
@go build -v .

# Run tests
test:
@echo "Running tests..."
@go test -v -race .

# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
@go test -v -race -coverprofile=coverage.txt -covermode=atomic .
@go tool cover -html=coverage.txt -o coverage.html
@echo "Coverage report generated: coverage.html"

# Run benchmark tests
test-bench:
@echo "Running benchmark tests..."
@go test -bench=. -benchmem .

# Run golangci-lint (requires installation)
lint:
@echo "Running golangci-lint..."
@which golangci-lint > /dev/null || (echo "golangci-lint not installed. Run 'make install-tools'" && exit 1)
@golangci-lint run .

# Format code
fmt:
@echo "Formatting code..."
@go fmt .

# Run go vet
vet:
@echo "Running go vet..."
@go vet .

# Clean build artifacts
clean:
@echo "Cleaning..."
@rm -f coverage.txt coverage.html
@go clean -cache -testcache -modcache
@rm -rf bin/

# Run the example program
example:
@echo "Running example..."
@cd examples && go run demo.go

# Run the Wails UI example (requires Wails v3 with UI support)
example-ui:
@echo "Running Wails UI example..."
@cd examples && go run main.go

# Install development tools
install-tools:
@echo "Installing development tools..."
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@echo "Tools installed successfully"
Loading
Loading