From 2f4f22d9c32c6a47f3d2e23e5aa31204983fa47c Mon Sep 17 00:00:00 2001 From: Dominic Black Date: Fri, 2 Feb 2024 16:16:17 +0000 Subject: [PATCH] Fix static analysis bugs --- cli/daemon/run/runtime_config.go | 1 + pkg/errinsrc/srcrender.go | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cli/daemon/run/runtime_config.go b/cli/daemon/run/runtime_config.go index 82b345e315..33c430657e 100644 --- a/cli/daemon/run/runtime_config.go +++ b/cli/daemon/run/runtime_config.go @@ -236,6 +236,7 @@ func (g *RuntimeEnvGenerator) runtimeConfigForServices(services []*meta.Service, for _, svc := range services { // Configure all the SQL databases for the service for _, sqlDB := range g.dbsBySvc[svc.Name] { + // nosemgrep server, db, err := g.InfraManager.SQLConfig(sqlDB) if err != nil { return "", errors.Wrapf(err, "failed to generate SQL config for database %s for service %s", db.DatabaseName, svc.Name) diff --git a/pkg/errinsrc/srcrender.go b/pkg/errinsrc/srcrender.go index 4946f0e6b6..989751d39c 100644 --- a/pkg/errinsrc/srcrender.go +++ b/pkg/errinsrc/srcrender.go @@ -338,9 +338,7 @@ func renderErrorText(builder *strings.Builder, startCol int, numDigitsInLineNumb // It's possible the start column references generated code; in that case reset // the column information as a fallback to prevent panics below. - if startCol > len(srcLine) { - startCol = 0 - } else { + if startCol <= len(srcLine) { // Compute the whitespace prefix we need on each line // (Note this will render tabs as tabs still if they are present) prefixWhitespace = strings.Repeat(" ", calcNumberCharactersForColumnNumber(srcLine, startCol-1))