Skip to content

Commit b5c8894

Browse files
authored
ci: use reviewdog and use gci linter for imports instead of goimports (DataDog#2010)
1 parent 118dc30 commit b5c8894

File tree

80 files changed

+199
-192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+199
-192
lines changed

.github/workflows/unit-integration-tests.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ jobs:
3030
with:
3131
repository: 'DataDog/dd-trace-go'
3232
- name: golangci-lint
33-
uses: golangci/golangci-lint-action@v3
33+
uses: reviewdog/action-golangci-lint@v2
3434
with:
35-
version: v1.52.2
35+
golangci_lint_version: v1.52.2
36+
fail_on_error: true
37+
reporter: github-pr-review
3638

3739
test-core:
3840
runs-on: ubuntu-latest
@@ -47,7 +49,7 @@ jobs:
4749
DD_APM_ENABLED: true
4850
DD_BIND_HOST: "0.0.0.0"
4951
DD_API_KEY: "invalid_key_but_this_is_fine"
50-
# We need to specify a custom health-check. By default, this container will remain "unhealthy" since
52+
# We need to specify a custom health-check. By default, this container will remain "unhealthy" since
5153
# we don't fully configure it with a valid API key (and possibly other reasons)
5254
# This command just checks for our ability to connect to port 8126
5355
options: >-
@@ -99,7 +101,7 @@ jobs:
99101
DD_APM_ENABLED: true
100102
DD_BIND_HOST: "0.0.0.0"
101103
DD_API_KEY: "invalid_key_but_this_is_fine"
102-
# We need to specify a custom health-check. By default, this container will remain "unhealthy" since
104+
# We need to specify a custom health-check. By default, this container will remain "unhealthy" since
103105
# we don't fully configure it with a valid API key (and possibly other reasons)
104106
# This command just checks for our ability to connect to port 8126
105107
options: >-

.golangci.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ linters:
77
disable-all: true
88
enable:
99
- gofmt
10-
- goimports
10+
- gci
1111
- revive
1212
- bodyclose
13+
linters-settings:
14+
gci:
15+
sections:
16+
- standard
17+
- prefix(gopkg.in/DataDog/dd-trace-go.v1)
18+
- default
19+
skip-generated: true
20+
custom-order: true

appsec/appsec_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import (
99
"context"
1010
"testing"
1111

12-
"github.com/stretchr/testify/require"
13-
1412
"gopkg.in/DataDog/dd-trace-go.v1/appsec"
1513
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
1614
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
1715
privateAppsec "gopkg.in/DataDog/dd-trace-go.v1/internal/appsec"
16+
17+
"github.com/stretchr/testify/require"
1818
)
1919

2020
func TestTrackUserLoginSuccessEvent(t *testing.T) {

contrib/Shopify/sarama/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ package sarama_test
88
import (
99
"log"
1010

11-
"github.com/Shopify/sarama"
12-
1311
saramatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama"
1412
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
13+
14+
"github.com/Shopify/sarama"
1515
)
1616

1717
func Example_asyncProducer() {

contrib/aws/aws-sdk-go-v2/aws/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"context"
1010
"log"
1111

12+
awstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go-v2/aws"
13+
1214
awscfg "github.com/aws/aws-sdk-go-v2/config"
1315
"github.com/aws/aws-sdk-go-v2/service/sqs"
14-
15-
awstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go-v2/aws"
1616
)
1717

1818
func Example() {

contrib/aws/aws-sdk-go/aws/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
package aws_test
77

88
import (
9+
awstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws"
10+
911
"github.com/aws/aws-sdk-go/aws"
1012
"github.com/aws/aws-sdk-go/aws/session"
1113
"github.com/aws/aws-sdk-go/service/s3"
12-
13-
awstrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/aws/aws-sdk-go/aws"
1414
)
1515

1616
// To start tracing requests, wrap the AWS session.Session by invoking

contrib/bradfitz/gomemcache/memcache/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ package memcache_test
88
import (
99
"context"
1010

11-
"github.com/bradfitz/gomemcache/memcache"
12-
1311
memcachetrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/bradfitz/gomemcache/memcache"
1412
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
13+
14+
"github.com/bradfitz/gomemcache/memcache"
1515
)
1616

1717
func Example() {

contrib/bradfitz/gomemcache/memcache/memcache.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import (
1515
"context"
1616
"math"
1717

18-
"github.com/bradfitz/gomemcache/memcache"
19-
2018
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace"
2119
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
2220
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
2321
"gopkg.in/DataDog/dd-trace-go.v1/internal/log"
2422
"gopkg.in/DataDog/dd-trace-go.v1/internal/telemetry"
23+
24+
"github.com/bradfitz/gomemcache/memcache"
2525
)
2626

2727
const componentName = "bradfitz/gomemcache/memcache"

contrib/bradfitz/gomemcache/memcache/memcache_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import (
1515
"testing"
1616
"time"
1717

18-
"github.com/bradfitz/gomemcache/memcache"
19-
"github.com/stretchr/testify/assert"
20-
"github.com/stretchr/testify/require"
21-
2218
"gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/namingschematest"
2319
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
2420
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
2521
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
2622
"gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig"
23+
24+
"github.com/bradfitz/gomemcache/memcache"
25+
"github.com/stretchr/testify/assert"
26+
"github.com/stretchr/testify/require"
2727
)
2828

2929
func TestMemcache(t *testing.T) {

contrib/confluentinc/confluent-kafka-go/kafka/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ package kafka_test
88
import (
99
"fmt"
1010

11-
"github.com/confluentinc/confluent-kafka-go/kafka"
12-
1311
kafkatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/confluentinc/confluent-kafka-go/kafka"
1412
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
13+
14+
"github.com/confluentinc/confluent-kafka-go/kafka"
1515
)
1616

1717
var (

contrib/confluentinc/confluent-kafka-go/kafka/option_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
"math"
1010
"testing"
1111

12-
"github.com/stretchr/testify/assert"
13-
1412
"gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig"
13+
14+
"github.com/stretchr/testify/assert"
1515
)
1616

1717
func TestAnalyticsSettings(t *testing.T) {

contrib/database/sql/example_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ import (
99
"context"
1010
"log"
1111

12-
sqlite "github.com/mattn/go-sqlite3" // Setup application to use Sqlite
13-
1412
sqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql"
1513
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
1614
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
1715

1816
"github.com/go-sql-driver/mysql"
1917
"github.com/lib/pq"
18+
sqlite "github.com/mattn/go-sqlite3" // Setup application to use Sqlite
2019
)
2120

2221
func Example() {

contrib/database/sql/internal/dsn_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ package internal
88
import (
99
"testing"
1010

11-
"github.com/stretchr/testify/assert"
12-
1311
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
12+
13+
"github.com/stretchr/testify/assert"
1414
)
1515

1616
func TestParseDSN(t *testing.T) {

contrib/database/sql/propagation_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import (
1111
"regexp"
1212
"testing"
1313

14-
"github.com/stretchr/testify/assert"
15-
"github.com/stretchr/testify/require"
16-
1714
"gopkg.in/DataDog/dd-trace-go.v1/contrib/database/sql/internal"
1815
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
1916
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
2017
"gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig"
18+
19+
"github.com/stretchr/testify/assert"
20+
"github.com/stretchr/testify/require"
2121
)
2222

2323
func TestDBMPropagation(t *testing.T) {

contrib/elastic/go-elasticsearch.v6/elastictrace_v6_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import (
1111
"strings"
1212
"testing"
1313

14-
elasticsearch6 "github.com/elastic/go-elasticsearch/v6"
15-
esapi6 "github.com/elastic/go-elasticsearch/v6/esapi"
16-
"github.com/stretchr/testify/assert"
17-
1814
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
1915
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
2016
"gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig"
17+
18+
elasticsearch6 "github.com/elastic/go-elasticsearch/v6"
19+
esapi6 "github.com/elastic/go-elasticsearch/v6/esapi"
20+
"github.com/stretchr/testify/assert"
2121
)
2222

2323
func checkGETTraceV6(assert *assert.Assertions, mt mocktracer.Tracer) {

contrib/elastic/go-elasticsearch.v6/elastictrace_v7_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import (
1111
"strings"
1212
"testing"
1313

14-
elasticsearch7 "github.com/elastic/go-elasticsearch/v7"
15-
esapi7 "github.com/elastic/go-elasticsearch/v7/esapi"
16-
"github.com/stretchr/testify/assert"
17-
1814
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
1915
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
2016
"gopkg.in/DataDog/dd-trace-go.v1/internal/globalconfig"
17+
18+
elasticsearch7 "github.com/elastic/go-elasticsearch/v7"
19+
esapi7 "github.com/elastic/go-elasticsearch/v7/esapi"
20+
"github.com/stretchr/testify/assert"
2121
)
2222

2323
func checkGETTraceV7(assert *assert.Assertions, mt mocktracer.Tracer) {

contrib/elastic/go-elasticsearch.v6/example_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"log"
1010
"strings"
1111

12-
elasticsearch "github.com/elastic/go-elasticsearch/v8"
13-
"github.com/elastic/go-elasticsearch/v8/esapi"
14-
1512
elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
1613
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
14+
15+
elasticsearch "github.com/elastic/go-elasticsearch/v8"
16+
"github.com/elastic/go-elasticsearch/v8/esapi"
1717
)
1818

1919
func Example_v8() {

contrib/emicklei/go-restful/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
"log"
1111
"net/http"
1212

13-
"github.com/emicklei/go-restful"
14-
1513
restfultrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/emicklei/go-restful"
1614
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
15+
16+
"github.com/emicklei/go-restful"
1717
)
1818

1919
// To start tracing requests, add the trace filter to your go-restful router.

contrib/globalsign/mgo/pipe.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
package mgo
77

88
import (
9-
"github.com/globalsign/mgo"
10-
119
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
10+
11+
"github.com/globalsign/mgo"
1212
)
1313

1414
// Pipe is an mgo.Pipe instance along with the data necessary for tracing.

contrib/go-chi/chi.v5/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ package chi_test
88
import (
99
"net/http"
1010

11-
"github.com/go-chi/chi/v5"
12-
1311
chitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi.v5"
1412
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
13+
14+
"github.com/go-chi/chi/v5"
1515
)
1616

1717
func handler(w http.ResponseWriter, _ *http.Request) {

contrib/go-chi/chi/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ package chi_test
88
import (
99
"net/http"
1010

11-
"github.com/go-chi/chi"
12-
1311
chitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi"
1412
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
13+
14+
"github.com/go-chi/chi"
1515
)
1616

1717
func handler(w http.ResponseWriter, _ *http.Request) {

contrib/go-redis/redis.v7/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"context"
1010
"time"
1111

12-
"github.com/go-redis/redis/v7"
13-
1412
redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis.v7"
1513
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
1614
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
15+
16+
"github.com/go-redis/redis/v7"
1717
)
1818

1919
// To start tracing Redis, simply create a new client using the library and continue

contrib/go-redis/redis.v8/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"context"
1010
"time"
1111

12-
"github.com/go-redis/redis/v8"
13-
1412
redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis.v8"
1513
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
1614
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
15+
16+
"github.com/go-redis/redis/v8"
1717
)
1818

1919
// To start tracing Redis, simply create a new client using the library and continue

contrib/go-redis/redis/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"context"
1010
"time"
1111

12-
"github.com/go-redis/redis"
13-
1412
redistrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-redis/redis"
1513
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
1614
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
15+
16+
"github.com/go-redis/redis"
1717
)
1818

1919
// To start tracing Redis, simply create a new client using the library and continue

contrib/go.mongodb.org/mongo-driver/mongo/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ package mongo_test
88
import (
99
"context"
1010

11+
mongotrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go.mongodb.org/mongo-driver/mongo"
12+
1113
"go.mongodb.org/mongo-driver/bson"
1214
"go.mongodb.org/mongo-driver/mongo"
1315
"go.mongodb.org/mongo-driver/mongo/options"
14-
15-
mongotrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go.mongodb.org/mongo-driver/mongo"
1616
)
1717

1818
func Example() {

contrib/gocql/gocql/example_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ package gocql_test
88
import (
99
"context"
1010

11-
"github.com/gocql/gocql"
12-
1311
gocqltrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gocql/gocql"
1412
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
1513
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
14+
15+
"github.com/gocql/gocql"
1616
)
1717

1818
// To trace Cassandra commands, use our query wrapper WrapQuery.

0 commit comments

Comments
 (0)