don't scare the gosec linter

This commit is contained in:
Cory Schwartz 2021-05-25 23:55:46 -07:00
parent e6b631078f
commit d50b59b4c7

View File

@ -17,19 +17,20 @@ const (
envAgentEndpoint = "LOTUS_JAEGER_AGENT_ENDPOINT" envAgentEndpoint = "LOTUS_JAEGER_AGENT_ENDPOINT"
envAgentHost = "LOTUS_JAEGER_AGENT_HOST" envAgentHost = "LOTUS_JAEGER_AGENT_HOST"
envAgentPort = "LOTUS_JAEGER_AGENT_PORT" envAgentPort = "LOTUS_JAEGER_AGENT_PORT"
envUsername = "LOTUS_JAEGER_USERNAME" envJaegerUser = "LOTUS_JAEGER_USERNAME"
envPassword = "LOTUS_JAEGER_PASSWORD" envJaegerCred = "LOTUS_JAEGER_PASSWORD"
) )
// When sending directly to the collector, agent options are ignored. // When sending directly to the collector, agent options are ignored.
// The collector endpoint is an HTTP or HTTPs URL. // The collector endpoint is an HTTP or HTTPs URL.
// The agent endpoint is a thrift/udp protocol given like "hostname:port" // The agent endpoint is a thrift/udp protocol and should be given
// or separate host and port environment variables. // as a string like "hostname:port". The agent can also be configured
// with separate host and port variables.
func jaegerOptsFromEnv(opts *jaeger.Options) bool { func jaegerOptsFromEnv(opts *jaeger.Options) bool {
var e string var e string
var ok bool var ok bool
if e, ok = os.LookupEnv(envUsername); ok { if e, ok = os.LookupEnv(envJaegerUser); ok {
if p, ok := os.LookupEnv(envPassword); ok { if p, ok := os.LookupEnv(envJaegerCred); ok {
opts.Username = e opts.Username = e
opts.Password = p opts.Password = p
} else { } else {
@ -67,7 +68,7 @@ func SetupJaegerTracing(serviceName string) *jaeger.Exporter {
opts.ServiceName = serviceName opts.ServiceName = serviceName
je, err := jaeger.NewExporter(opts) je, err := jaeger.NewExporter(opts)
if err != nil { if err != nil {
log.Errorw("Failed to create the Jaeger exporter", "error", err) log.Errorw("failed to create the jaeger exporter", "error", err)
return nil return nil
} }