fix: remove unused TestContext (#1013)

The function `WithTestContext` is never called in the project, and
there is just one usage of `TestContext`, inside one of our loggers

Co-authored-by: Casey Lee <cplee@nektos.com>
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Robert Kowalski 2022-03-14 18:47:16 +01:00 committed by GitHub
parent 6b059572ff
commit 1e92d87b75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 26 deletions

View File

@ -1,20 +0,0 @@
package common
import (
"context"
)
type testFlagContextKey string
const testFlagContextKeyVal = testFlagContextKey("test-context")
// TestContext returns whether the context has the test flag set
func TestContext(ctx context.Context) bool {
val := ctx.Value(testFlagContextKeyVal)
return val != nil
}
// WithTextContext sets the test flag in the context
func WithTestContext(ctx context.Context) context.Context {
return context.WithValue(ctx, testFlagContextKeyVal, true)
}

View File

@ -58,12 +58,6 @@ func WithJobLogger(ctx context.Context, jobName string, config *Config, masks *[
nextColor++
logger := logrus.New()
if common.TestContext(ctx) {
fieldLogger := common.Logger(ctx)
if fieldLogger != nil {
logger = fieldLogger.(*logrus.Logger)
}
}
logger.SetFormatter(formatter)
logger.SetOutput(os.Stdout)
logger.SetLevel(logrus.GetLevel())