Skip to content

Commit 873c9fd

Browse files
authored
Enforce go fmt in CI (errors are present). (#313)
* Enforce go fmt in CI (errors are present). * s/esle/else * Fix fmt * Use existing linter without simplify. * Adjust copyright.
1 parent aba050a commit 873c9fd

File tree

8 files changed

+16
-13
lines changed

8 files changed

+16
-13
lines changed

.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ linters-settings:
2525
- wrapperFunc
2626
- hugeParam
2727
- rangeValCopy
28+
gofmt:
29+
simplify: false
2830

2931
linters:
3032
disable-all: true
@@ -54,6 +56,7 @@ linters:
5456
- gosimple
5557
- prealloc
5658
- maligned
59+
- gofmt
5760
fast: false
5861

5962
run:

optimizely.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019, Optimizely, Inc. and contributors *
2+
* Copyright 2019, 2021 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -32,7 +32,7 @@ func Client(sdkKey string, options ...client.OptionFunc) (*client.OptimizelyClie
3232
// UserContext is a helper method for creating a user context
3333
func UserContext(userID string, attributes map[string]interface{}) entities.UserContext {
3434
return entities.UserContext{
35-
ID: userID,
35+
ID: userID,
3636
Attributes: attributes,
3737
}
3838
}

pkg/decision/bucketer/experiment_bucketer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestBucketExclusionGroups(t *testing.T) {
4747
},
4848
}
4949

50-
bucketer := NewMurmurhashExperimentBucketer(logging.GetLogger("","TestBucketExclusionGroups" ), DefaultHashSeed)
50+
bucketer := NewMurmurhashExperimentBucketer(logging.GetLogger("", "TestBucketExclusionGroups"), DefaultHashSeed)
5151
// ppid2 + 1886780722 (groupId) will generate bucket value of 2434 which maps to experiment 1
5252
bucketedVariation, reason, _ := bucketer.Bucket("ppid2", experiment1, exclusionGroup)
5353
assert.Equal(t, experiment1.Variations["22222"], *bucketedVariation)

pkg/decision/bucketer/murmurhashbucketer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019, Optimizely, Inc. and contributors *
2+
* Copyright 2019, 2021 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -49,7 +49,7 @@ type MurmurhashBucketer struct {
4949
func NewMurmurhashBucketer(logger logging.OptimizelyLogProducer, hashSeed uint32) *MurmurhashBucketer {
5050
return &MurmurhashBucketer{
5151
hashSeed: hashSeed,
52-
logger: logger,
52+
logger: logger,
5353
}
5454
}
5555

pkg/logging/level_log_consumer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019, Optimizely, Inc. and contributors *
2+
* Copyright 2019, 2021 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -46,7 +46,7 @@ func (l *FilteredLevelLogConsumer) Log(level LogLevel, message string, fields ma
4646
sort.Strings(keys)
4747

4848
for _, k := range keys {
49-
if s, ok := fields[k].(string);ok && s != "" {
49+
if s, ok := fields[k].(string); ok && s != "" {
5050
fmt.Fprintf(&messBuilder, "[%s]", s)
5151
}
5252
}

pkg/notification/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019-2020, Optimizely, Inc. and contributors *
2+
* Copyright 2019-2021, Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -43,7 +43,7 @@ type AtomicManager struct {
4343
// NewAtomicManager creates a new instance of the atomic manager
4444
func NewAtomicManager(logger logging.OptimizelyLogProducer) *AtomicManager {
4545
return &AtomicManager{
46-
logger: logger,
46+
logger: logger,
4747
handlers: make(map[uint32]func(interface{})),
4848
}
4949
}

pkg/utils/execgroup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019, Optimizely, Inc. and contributors *
2+
* Copyright 2019, 2021 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -36,7 +36,7 @@ func NewExecGroup(ctx context.Context, logger logging.OptimizelyLogProducer) *Ex
3636
nctx, cancelFn := context.WithCancel(ctx)
3737
wg := sync.WaitGroup{}
3838

39-
return &ExecGroup{wg: &wg, ctx: nctx, cancelFunc: cancelFn, logger:logger}
39+
return &ExecGroup{wg: &wg, ctx: nctx, cancelFunc: cancelFn, logger: logger}
4040
}
4141

4242
// Go initiates a goroutine with the inputted function. Each invocation increments a shared WaitGroup

pkg/utils/requester_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2019, Optimizely, Inc. and contributors *
2+
* Copyright 2019, 2021 Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -40,7 +40,7 @@ func TestHeaders(t *testing.T) {
4040
func TestAddHeaders(t *testing.T) {
4141

4242
req, _ := http.NewRequest("GET", "", nil)
43-
requester := &HTTPRequester{logger:logging.GetLogger("", "")}
43+
requester := &HTTPRequester{logger: logging.GetLogger("", "")}
4444
headers := []Header{{"one", "1"}}
4545

4646
fn := Headers(Header{"two", "2"})

0 commit comments

Comments
 (0)