Skip to content

Commit

Permalink
chore: enable linting of package import order, and fix existing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWinikates committed Sep 7, 2023
1 parent 5fef1bf commit f5977c2
Show file tree
Hide file tree
Showing 29 changed files with 58 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ linters:
# - gosimple
- govet
- gofmt
# - gci
- gci
# - revive
# - ineffassign
# - staticcheck
Expand Down
3 changes: 2 additions & 1 deletion internal/auth/csp_service.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package auth

import (
"github.com/wavefronthq/wavefront-sdk-go/internal/auth/csp"
"log"
"net/http"
"sync"
"time"

"github.com/wavefronthq/wavefront-sdk-go/internal/auth/csp"
)

type tokenResult struct {
Expand Down
5 changes: 3 additions & 2 deletions internal/auth/csp_service_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package auth

import (
"github.com/stretchr/testify/assert"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth/csp"
"net/http"
"net/http/httptest"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth/csp"
)

func TestCSPService_MultipleCSPRequests(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/auth/ticker_interval_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package auth

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

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

func TestCalculateNewTickerInterval(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/event/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package event
import (
"encoding/json"
"fmt"
"strconv"

"github.com/wavefronthq/wavefront-sdk-go/event"
"github.com/wavefronthq/wavefront-sdk-go/internal"
"strconv"
)

// Line encode the event to a wf proxy format
Expand Down
3 changes: 2 additions & 1 deletion internal/histogram/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"bytes"
"errors"
"fmt"
"strconv"

"github.com/wavefronthq/wavefront-sdk-go/histogram"
"github.com/wavefronthq/wavefront-sdk-go/internal"
"strconv"
)

// Gets a histogram line in the Wavefront histogram data format:
Expand Down
3 changes: 2 additions & 1 deletion internal/histogram/formatter_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package histogram

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/wavefronthq/wavefront-sdk-go/histogram"
"testing"
)

var line string
Expand Down
5 changes: 3 additions & 2 deletions internal/lines.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package internal
import (
"errors"
"fmt"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"github.com/wavefronthq/wavefront-sdk-go/internal/sdkmetrics"
"log"
"net/http"
"strings"
"sync"
"sync/atomic"
"time"

"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"github.com/wavefronthq/wavefront-sdk-go/internal/sdkmetrics"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/lines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package internal

import (
"fmt"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"net/http"
"testing"

"github.com/stretchr/testify/assert"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
)

type fakeReporter struct {
Expand Down
3 changes: 2 additions & 1 deletion internal/metric/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package metric
import (
"errors"
"fmt"
"github.com/wavefronthq/wavefront-sdk-go/internal"
"strconv"

"github.com/wavefronthq/wavefront-sdk-go/internal"
)

// Gets a metric line in the Wavefront metrics data format:
Expand Down
3 changes: 2 additions & 1 deletion internal/metric/formatter_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package metric

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

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

var line string
Expand Down
3 changes: 2 additions & 1 deletion internal/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"bytes"
"compress/gzip"
"crypto/tls"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"io"
"net/http"
"strings"
"time"

"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
)

// The implementation of a Reporter that reports points directly to a Wavefront server.
Expand Down
7 changes: 4 additions & 3 deletions internal/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package internal
import (
"crypto/tls"
"crypto/x509"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"net/http"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
)

func TestReporter_BuildRequest(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/sanitize_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package internal

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

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

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

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

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

func TestRealMetricRegistry(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion internal/span/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/wavefronthq/wavefront-sdk-go/internal"
"strconv"

"github.com/wavefronthq/wavefront-sdk-go/internal"
)

// Line gets a span line in the Wavefront span data format:
Expand Down
3 changes: 2 additions & 1 deletion internal/span/formatter_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package span

import (
"testing"

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

var line string
Expand Down
3 changes: 2 additions & 1 deletion internal/utils_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package internal

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

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

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

import (
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"log"

"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
)

func tokenServiceForCfg(cfg *configuration) auth.Service {
Expand Down
3 changes: 2 additions & 1 deletion senders/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package senders
import (
"crypto/tls"
"fmt"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"log"
"net/url"
"strconv"
"strings"
"time"

"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion senders/example_newsender_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package senders_test

import (
"crypto/tls"
wavefront "github.com/wavefronthq/wavefront-sdk-go/senders"
"time"

wavefront "github.com/wavefronthq/wavefront-sdk-go/senders"
)

func ExampleNewSender_options() {
Expand Down
3 changes: 2 additions & 1 deletion senders/integration_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package senders

import (
"testing"

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

func TestEndToEnd(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion senders/live_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package senders

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

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

func skipUnlessVarsAreSet(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions senders/new_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package senders

import (
"fmt"

"github.com/wavefronthq/wavefront-sdk-go/internal"
"github.com/wavefronthq/wavefront-sdk-go/internal/sdkmetrics"
)
Expand Down
2 changes: 1 addition & 1 deletion senders/new_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package senders
import (
"crypto/tls"
"crypto/x509"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
)

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

import (
"crypto/tls"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
"time"

"github.com/wavefronthq/wavefront-sdk-go/internal/auth"
)

// Option Wavefront client configuration options
Expand Down
5 changes: 3 additions & 2 deletions senders/real_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package senders

import (
"fmt"
"os"
"strconv"

"github.com/wavefronthq/wavefront-sdk-go/event"
"github.com/wavefronthq/wavefront-sdk-go/histogram"
"github.com/wavefronthq/wavefront-sdk-go/internal"
Expand All @@ -11,8 +14,6 @@ import (
"github.com/wavefronthq/wavefront-sdk-go/internal/sdkmetrics"
"github.com/wavefronthq/wavefront-sdk-go/internal/span"
"github.com/wavefronthq/wavefront-sdk-go/version"
"os"
"strconv"
)

// Sender Interface for sending metrics, distributions and spans to Wavefront
Expand Down
3 changes: 1 addition & 2 deletions senders/real_sender_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package senders

import (
"github.com/wavefronthq/wavefront-sdk-go/internal/auth/csp"
"net/http/httptest"
"net/url"
"testing"

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

"github.com/wavefronthq/wavefront-sdk-go/histogram"
"github.com/wavefronthq/wavefront-sdk-go/internal/auth/csp"
)

func TestSendDirect(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion senders/wavefront_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package senders

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
"github.com/wavefronthq/wavefront-sdk-go/histogram"
"github.com/wavefronthq/wavefront-sdk-go/internal/sdkmetrics"
"testing"
)

func TestWavefrontSender_SendMetric(t *testing.T) {
Expand Down

0 comments on commit f5977c2

Please sign in to comment.