Skip to content

[lint-monster] Fix: Replace log.Printf/log.Print with pkg/logger in library packages (38 violations) #33681

@github-actions

Description

@github-actions

Log Package Usage Violations

Category: Logging standardization
Scope: Library packages (pkg/)
Finding Count: 38 direct log.Printf/log.Print calls
Standard: Must use pkg/logger for all debug/diagnostic logging

Affected Files

  1. pkg/envutil/envutil.go - 2 violations (lines 33, 56)
  2. pkg/fileutil/fileutil.go - 9 violations (lines 40, 49, 53, 66, 85, 88, 134, 149, 152, 159, 167)
  3. pkg/gitutil/gitutil.go - 6 violations (lines 33, 44, 86, 90, 96, 100, 174, 179)
  4. pkg/typeutil/convert.go - 3 violations (lines 58, 66, 105)
  5. pkg/repoutil/repoutil.go - 3 violations (lines 16, 19, 22)
  6. pkg/semverutil/semverutil.go - 6 violations (lines 63, 67, 110, 112, 114, 149)
  7. pkg/workflow/create_entity_helpers.go - 2 violations (lines 61, 68)
  8. pkg/workflow/parse_helpers.go - 1 violation (line 34)
  9. pkg/cli/mcp_server_http.go - 2 violations (lines 42, 53)

Remediation Pattern

Current (WRONG)

import "log"

func someFunction() {
    log.Printf("Something happened: %v", value)
}

New (CORRECT)

import "github.com/github/gh-aw/pkg/logger"

var log = logger.New("pkg:filename")  // at package level

func someFunction() {
    log.Printf("Something happened: %v", value)  // Only when DEBUG matches
}

Remediation Checklist

  • Add logger import: github.com/github/gh-aw/pkg/logger
  • Remove log import: Remove import "log"
  • Create package logger: Add var log = logger.New("pkg:filename") at package level
  • Migrate all log calls: Replace all log.Printf() and log.Print() calls (unchanged API)
  • Category naming: Use convention pkg:filename (e.g., fileutil:fileutil, gitutil:gitutil)
  • Run validation: Execute make golint-custom to verify all violations are fixed
  • Test: make test-unit to ensure no behavior changes (logging is debug-only)
  • Commit with message: Reference this issue

Benefits

✅ Centralized debug logging control via DEBUG environment variable
✅ Consistent logging format and styling
✅ Zero overhead when DEBUG doesn't match category
✅ Supports wildcard patterns: DEBUG=pkg:* DEBUG=*,!fileutil:*

Expected Outcome

All library packages should use pkg/logger exclusively. No direct log.Printf or log.Print calls in pkg/ directories.


Created by: LintMonster
Report: Daily custom lint scan

Generated by 🧌 LintMonster · ● 601.6K ·

  • expires on May 28, 2026, 3:50 AM UTC

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions