Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lints #117

Merged
merged 3 commits into from
Jun 11, 2019
Merged

Lints #117

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ linters:
- dupl
- errcheck
- gochecknoinits
- goconst
- gocritic
- gocyclo
- gofmt
Expand Down
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ module github.com/aws/aws-xray-sdk-go
require (
github.com/DATA-DOG/go-sqlmock v1.2.0
github.com/aws/aws-sdk-go v1.17.12
github.com/davecgh/go-spew v0.0.0-20160907170601-6d212800a42e
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af
github.com/davecgh/go-spew v0.0.0-20160907170601-6d212800a42e // indirect
github.com/pkg/errors v0.8.1
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0 // indirect
github.com/stretchr/testify v1.1.4
golang.org/x/net v0.0.0-20190301231341-16b79f2e4e95
golang.org/x/text v0.0.0-20190306152657-5d731a35f486
golang.org/x/net v0.0.0-20190311183353-d8887717615a
)
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0 h1:GD+A8+e+wFkq
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.1.4 h1:ToftOQTytwshuOSj6bDSolVUa3GINfJP/fg3OkkOzQQ=
github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/net v0.0.0-20190301231341-16b79f2e4e95 h1:fY7Dsw114eJN4boqzVSbpVHO6rTdhq6/GnXeu+PKnzU=
golang.org/x/net v0.0.0-20190301231341-16b79f2e4e95/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/text v0.0.0-20190306152657-5d731a35f486 h1:XzEEnDs8NtiSU8gJvzuDjv+Kam+0nPN9pjOA3oZlxIY=
golang.org/x/text v0.0.0-20190306152657-5d731a35f486/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
2 changes: 1 addition & 1 deletion internal/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/aws/aws-xray-sdk-go/xraylog"
)

// This internal pacakge hides the actual logging functions from the user.
// This internal package hides the actual logging functions from the user.

// The Logger instance used by xray to log. Set via xray.SetLogger().
var Logger xraylog.Logger = xraylog.NewDefaultLogger(os.Stdout, xraylog.LogLevelInfo)
Expand Down
6 changes: 3 additions & 3 deletions resources/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion strategy/sampling/centralized_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ func TestRefreshManifestRuleAddition(t *testing.T) {
assert.Equal(t, r2, ss.manifest.Rules[1])
assert.Equal(t, r3, ss.manifest.Rules[2])

// Assert on size of manfiest
// Assert on size of manifest
assert.Equal(t, 3, len(ss.manifest.Rules))
assert.Equal(t, 3, len(ss.manifest.Index))

Expand Down
16 changes: 1 addition & 15 deletions xray/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,6 @@ var xRayBeforeSignHandler = request.NamedHandler{
},
}

var xRayAfterSignHandler = request.NamedHandler{
Name: "XRayAfterSignHandler",
Fn: func(r *request.Request) {
endSubsegment(r)
},
}

var xRayBeforeSendHandler = request.NamedHandler{
Name: "XRayBeforeSendHandler",
Fn: func(r *request.Request) {
},
}

var xRayAfterSendHandler = request.NamedHandler{
Name: "XRayAfterSendHandler",
Fn: func(r *request.Request) {
Expand Down Expand Up @@ -287,8 +274,7 @@ func (j *jsonMap) data() interface{} {
}

func (j *jsonMap) search(keys ...string) *jsonMap {
var object interface{}
object = j.data()
object := j.data()

for target := 0; target < len(keys); target++ {
if mmap, ok := object.(map[string]interface{}); ok {
Expand Down
2 changes: 1 addition & 1 deletion xray/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (te *TestEmitter) Emit(seg *Segment) {}
func (te *TestEmitter) RefreshEmitterWithAddress(raddr *net.UDPAddr) {}

func (cms *TestContextMissingStrategy) ContextMissing(v interface{}) {
fmt.Sprintf("Test ContextMissing Strategy %v", v)
fmt.Printf("Test ContextMissing Strategy %v\n", v)
}

func stashEnv() []string {
Expand Down
3 changes: 2 additions & 1 deletion xray/default_emitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ package xray
import (
"encoding/json"
"fmt"
"github.com/stretchr/testify/assert"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/assert"
)

func TestNoNeedStreamingStrategy(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion xray/default_streaming_strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
package xray

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestDefaultStreamingStrategyMaxSegmentSize(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion xray/lambda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package xray

import (
"context"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

func TestLambdaSegmentEmit(t *testing.T) {
Expand Down
6 changes: 2 additions & 4 deletions xray/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func BeginSubsegment(ctx context.Context, name string) (context.Context, *Segmen
name = name[:200]
}

parent := &Segment{}
var parent *Segment
// first time to create facade segment
if getTraceHeaderFromContext(ctx) != nil && GetSegment(ctx) == nil {
_, parent = newFacadeSegment(ctx)
Expand Down Expand Up @@ -445,10 +445,8 @@ func (seg *Segment) AddError(err error) error {
return nil
}

func (seg *Segment) addError(err error) error {
func (seg *Segment) addError(err error) {
seg.Fault = true
seg.GetCause().WorkingDirectory, _ = os.Getwd()
seg.GetCause().Exceptions = append(seg.GetCause().Exceptions, seg.ParentSegment.GetConfiguration().ExceptionFormattingStrategy.ExceptionFromError(err))

return nil
}
2 changes: 1 addition & 1 deletion xray/segment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestSubsegmentDataRace(t *testing.T) {
go func() {
defer wg.Done()
ctx, seg := BeginSubsegment(ctx, "TestSubsegment1")
ctx, seg2 := BeginSubsegment(ctx, "TestSubsegment2")
_, seg2 := BeginSubsegment(ctx, "TestSubsegment2")
seg2.Close(nil)
seg.Close(nil)
}()
Expand Down
2 changes: 1 addition & 1 deletion xray/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,4 @@ func processNilSegment(ctx context.Context) {
} else {
globalCfg.ContextMissingStrategy().ContextMissing(failedMessage)
}
}
}
3 changes: 2 additions & 1 deletion xray/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ package xray
import (
"context"
"encoding/json"
"github.com/aws/aws-xray-sdk-go/header"
"net"
"net/http"
"time"

"github.com/aws/aws-xray-sdk-go/header"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion xraylog/xray_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewDefaultLogger(w io.Writer, minLogLevel LogLevel) Logger {
}

type defaultLogger struct {
mu sync.Mutex
mu sync.Mutex
w io.Writer
minLevel LogLevel
}
Expand Down