1. Support unparam linter and fix found issues
2. Replace forked mvdan.cc/lint and mvdan.cc/interfacer with the
upstream ones
3. Minimize forked megacheck: move the most of it's code to this repo
4. Use golang.org/x/tools/go/ssa import path instead of custom fork
paths
5. In golang.org/x/tools/go/{ssa,callgraph} use changed code from
honnef.co/go/tools
6. Add megacheck.check-unexported option: it found some issues in
the repo, fixed them all
		
	
			
		
			
				
	
	
		
			49 lines
		
	
	
		
			831 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			831 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package logutils
 | 
						|
 | 
						|
import (
 | 
						|
	"os"
 | 
						|
	"strings"
 | 
						|
)
 | 
						|
 | 
						|
func getEnabledDebugs() map[string]bool {
 | 
						|
	ret := map[string]bool{}
 | 
						|
	debugVar := os.Getenv("GL_DEBUG")
 | 
						|
	if debugVar == "" {
 | 
						|
		return ret
 | 
						|
	}
 | 
						|
 | 
						|
	for _, tag := range strings.Split(debugVar, ",") {
 | 
						|
		ret[tag] = true
 | 
						|
	}
 | 
						|
 | 
						|
	return ret
 | 
						|
}
 | 
						|
 | 
						|
var enabledDebugs = getEnabledDebugs()
 | 
						|
 | 
						|
type DebugFunc func(format string, args ...interface{})
 | 
						|
 | 
						|
func nopDebugf(format string, args ...interface{}) {}
 | 
						|
 | 
						|
func Debug(tag string) DebugFunc {
 | 
						|
	if !enabledDebugs[tag] {
 | 
						|
		return nopDebugf
 | 
						|
	}
 | 
						|
 | 
						|
	return func(format string, args ...interface{}) {
 | 
						|
		logger := NewStderrLog(tag)
 | 
						|
		logger.SetLevel(LogLevelDebug)
 | 
						|
		logger.Debugf(format, args...)
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
func HaveDebugTag(tag string) bool {
 | 
						|
	return enabledDebugs[tag]
 | 
						|
}
 | 
						|
 | 
						|
func SetupVerboseLog(log Log, isVerbose bool) {
 | 
						|
	if isVerbose {
 | 
						|
		log.SetLevel(LogLevelInfo)
 | 
						|
	}
 | 
						|
}
 |