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

Adds UserAgent and CPU Usage optimization #102

Merged
merged 24 commits into from
Mar 25, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
codeclimate changes
briangann committed Mar 25, 2023

Verified

This commit was signed with the committer’s verified signature.
briangann Brian Gann
commit bd90b3be6f8d8c15fa19ee76cccd580759f06677
23 changes: 15 additions & 8 deletions Magefile.go
Original file line number Diff line number Diff line change
@@ -17,8 +17,13 @@ import (
// mg contains helpful utility functions, like Deps
)

// Build namespace
type Build mg.Namespace

// Test namespace
type Test mg.Namespace

// Run namespace
type Run mg.Namespace

var archTargets = map[string]map[string]string{
@@ -154,23 +159,23 @@ func test() error {
return sh.RunV("go", "tool", "cover", "-html=coverage.out", "-o", "coverage.html")
}

// Formats the source files
// Format Formats the source files
func (Build) Format() error {
if err := sh.RunV("gofmt", "-w", "./pkg"); err != nil {
return err
}
return nil
}

// Minimal build
// Local Minimal build
func (Build) Local(ctx context.Context) {
mg.Deps(
Clean,
kioskCmd,
)
}

// Lint/Format/Test/Build
// CI Lint/Format/Test/Build
func (Build) CI(ctx context.Context) {
mg.Deps(
Build.OSVScanner,
@@ -182,6 +187,7 @@ func (Build) CI(ctx context.Context) {
)
}

// All build all
func (Build) All(ctx context.Context) {
mg.Deps(
Build.Lint,
@@ -191,33 +197,34 @@ func (Build) All(ctx context.Context) {
)
}

// Run linter against codebase
// Lint Run linter against codebase
func (Build) Lint() error {
os.Setenv("GO111MODULE", "on")
log.Printf("Linting...")
return sh.RunV("golangci-lint", "--timeout", "5m", "run", "./pkg/...")
}

// OSVScanner Vulnerability scanning
func (Build) OSVScanner() error {
log.Printf("Scanning...")
return sh.RunV("osv-scanner", "--lockfile", "./go.mod")
}

// Run tests in verbose mode
// Verbose Run tests in verbose mode
func (Test) Verbose() {
mg.Deps(
testVerbose,
)
}

// Run tests in normal mode
// Default Run tests in normal mode
func (Test) Default() {
mg.Deps(
test,
)
}

// Removes built files
// Clean Removes built files
func Clean() {
log.Printf("Cleaning all")
os.RemoveAll("./bin/linux_386")
@@ -231,7 +238,7 @@ func Clean() {
os.RemoveAll("./bin/windows_amd64")
}

// Build and Run
// Local Build and Run
func (Run) Local() error {
mg.Deps(Build.Local)
return sh.RunV(