Showing 3 of 3 total issues
Function logMessageToLoki
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func logMessageToLoki(lp *logPair, message []byte) error {
stackStrSize := len(lp.logLine.StackName)
// Convert to Runes to avoid problems with multibytes (Unicode, UTF-8, UTF-16, etc) characters.
runes := []rune(lp.logLine.ServiceName)
Method Driver.StartLogging
has 7 return statements (exceeds 4 allowed). Open
Open
func (d *Driver) StartLogging(file string, logCtx logger.Info) error {
d.mu.Lock()
if _, exists := d.logs[path.Base(file)]; exists {
d.mu.Unlock()
return fmt.Errorf("logger for %q already exists", file)
Function handlers
has 5 return statements (exceeds 4 allowed). Open
Open
func handlers(h *sdk.Handler, d *driver.Driver) {
h.HandleFunc("/LogDriver.StartLogging", func(w http.ResponseWriter, r *http.Request) {
var req StartLoggingRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)