Skip to content

Commit

Permalink
chore: gofmt all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderblue committed Jul 20, 2023
1 parent 419dad1 commit c3b7a42
Show file tree
Hide file tree
Showing 35 changed files with 99 additions and 108 deletions.
10 changes: 5 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ linters-settings:
include-go-root: false
packages:
- github.com/davecgh/go-spew/spew
# misspell:
# ignore-words:
# - newrelic
misspell:
ignore-words:
- newrelic
lll:
# max line length, lines longer will be reported. Default is 120.
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
Expand All @@ -51,12 +51,12 @@ linters:
enable:
- errcheck
- gocyclo
# - gofmt
- gofmt
- revive
- gosimple
- govet
- ineffassign
# - misspell
- misspell
- staticcheck
- unconvert
- unused
Expand Down
2 changes: 1 addition & 1 deletion build/lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PROJECT_MODULE ?= $(shell $(GO) list -m)

GO_MOD_OUTDATED ?= go-mod-outdated

lint: deps lint-commit golangci goimports outdated # spell-check gofmt
lint: deps spell-check gofmt lint-commit golangci goimports outdated
lint-fix: deps spell-check-fix gofmt-fix goimports

#
Expand Down
3 changes: 2 additions & 1 deletion internal/http/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ func (r *GraphQLErrorResponse) IsPaymentRequired(resp *http.Response) bool {
// is deprecated. We want to bubble that up, but not stop returning data
//
// Example deprecation message:
// This field is deprecated! Please use `relatedEntities` instead.
//
// This field is deprecated! Please use `relatedEntities` instead.
func (r *GraphQLErrorResponse) IsDeprecated() bool {
for _, err := range r.Errors {
if strings.HasPrefix(err.Message, "This field is deprecated!") {
Expand Down
3 changes: 1 addition & 2 deletions newrelic/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ Package newrelic is a convenience package that provides a programmatic API surfa
area for interacting with all the New Relic One products encompassed by this project.
Refer to each package's documentation to learn more about its capabilities.
Authentication
# Authentication
You will need a valid Personal API to communicate with the backend New Relic
APIs that this client communicates with. See the API key documentation below
for more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package newrelic
3 changes: 2 additions & 1 deletion pkg/accountmanagement/accountmanagement_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package accountmanagement
import (
"testing"

mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
"github.com/stretchr/testify/require"

mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
)

func TestIntegrationCreateAccount(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/accounts/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
Package accounts provides a programmatic API for interacting with New Relic accounts.
It can be used to retrieve details about all accounts the user is authorized to view.
Authentication
# Authentication
You will need a valid Personal API key to communicate with the backend New Relic
API that provides this functionality. See the API key documentation below for
more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package accounts
3 changes: 2 additions & 1 deletion pkg/agentapplications/agentapplications_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package agentapplications
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/newrelic/newrelic-client-go/v2/pkg/common"
"github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
"github.com/stretchr/testify/require"
)

// GUID for Dummy App in integration test account
Expand Down
3 changes: 1 addition & 2 deletions pkg/alerts/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ Alerts product. It can be used for a variety of operations, including:
- Associating one or more alert conditions with a policy
Authentication
# Authentication
You will need a valid API key to communicate with the backend New Relic APIs
that provide this functionality. Use a Personal API key for authentication.
See the API key documentation below for more information on how to locate this
key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package alerts
2 changes: 1 addition & 1 deletion pkg/alerts/nrql_conditions_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ var (
}
)

//REST API integration test (deprecated)
// REST API integration test (deprecated)
func TestIntegrationNrqlConditions(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 1 addition & 1 deletion pkg/apiaccess/insights_keys_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestIntegrationAPIAccess_InsightsQueryKeys(t *testing.T) {
require.NotNil(t, deleteResult)
}

//nolint: unused
// nolint: unused
func newIntegrationTestClient(t *testing.T) APIAccess {
tc := mock.NewIntegrationTestConfig(t)

Expand Down
1 change: 1 addition & 0 deletions pkg/apiaccess/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"

"github.com/newrelic/newrelic-client-go/v2/internal/http"
)

Expand Down
6 changes: 4 additions & 2 deletions pkg/apiaccess/keys_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
package apiaccess

import (
mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
"github.com/stretchr/testify/require"
"regexp"
"strings"
"testing"

"github.com/stretchr/testify/require"

mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
)

func TestIntegrationAPIAccess_IngestKeys(t *testing.T) {
Expand Down
5 changes: 2 additions & 3 deletions pkg/apm/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ APM product. It can be used for a variety of operations, including:
- Creating, reading, and deleting APM labels
Authentication
# Authentication
You will need a valid Personal API key to communicate with the backend New Relic
APIs that provide this functionality. See the API key documentation below for
more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
Labels
# Labels
New Relic One entity tags are currently the preferred method for organizing your
New Relic resources. Consider using entity tags via the `entities` package if
you are just getting started. More information about entity tags and APM labels
can be found at the following URL:
https://docs.newrelic.com/docs/new-relic-one/use-new-relic-one/core-concepts/tagging-use-tags-organize-group-what-you-monitor#labels
*/
package apm
3 changes: 2 additions & 1 deletion pkg/cloud/cloud_api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"strings"
"testing"

mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
"github.com/stretchr/testify/require"

mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
)

func TestCloudAccount_Basic(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/cloud/cloud_api_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"strconv"
"testing"

mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
"github.com/stretchr/testify/assert"

mock "github.com/newrelic/newrelic-client-go/v2/pkg/testhelpers"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions pkg/config/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
Package config provides a configuration surface area for configuring the underlying
client.
Authentication
# Authentication
You will need a valid Personal API key to communicate with the backend New Relic
APIs that power the client. See the API key documentation below for more
information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package config
3 changes: 1 addition & 2 deletions pkg/dashboards/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ on working with these resources:
https://docs.newrelic.com/docs/insights/insights-api/manage-dashboards/insights-dashboard-api
Authentication
# Authentication
You will need a Personal API key to communicate with the backend New Relic API
that provides this functionality. See the API key documentation below for
more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package dashboards
3 changes: 1 addition & 2 deletions pkg/edge/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ Package edge provides a programmatic API for interacting with New Relic Edge wit
infinite tracing. It can be used to enable New Relic Edge and retrieve relevant
config parameters.
Authentication
# Authentication
You will need a valid Personal API key to communicate with the backend New Relic
API that provides this functionality. See the API key documentation below for
more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package edge
3 changes: 1 addition & 2 deletions pkg/entities/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ entities. It can be used for a variety of operations, including:
- Creating, reading, updating, and deleting New Relic One entity tags
Authentication
# Authentication
You will need a valid Personal API key to communicate with the backend New Relic
API that provides this functionality. See the API key documentation below for
more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package entities
28 changes: 16 additions & 12 deletions pkg/entities/entities_api.go

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

3 changes: 1 addition & 2 deletions pkg/events/doc.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/*
Package events provides a programmatic API for creating custom events in New Relic.
Authentication
# Authentication
You will need a valid Insights insert key to communicate with the backend New Relic
API that provides this functionality. See the API key documentation below for
more information on how to locate this key:
https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys
*/
package events
4 changes: 0 additions & 4 deletions pkg/events/events_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,9 @@ func (e *Events) Flush() error {
return nil
}

//
// batchWorker reads []byte from the queue until a threshold is passed,
// then copies the []byte it has read and sends that batch along to Insights
// in its own goroutine.
//
func (e *Events) batchWorker(ctx context.Context, id int) (err error) {
if e == nil {
return errors.New("batchWorker: invalid Events, unable to start worker")
Expand Down Expand Up @@ -173,10 +171,8 @@ func (e *Events) batchWorker(ctx context.Context, id int) (err error) {
}
}

//
// watchdog has a Timer that will send the results once the
// it has expired.
//
func (e *Events) watchdog(ctx context.Context) (err error) {
if e.eventTimer == nil {
return errors.New("invalid timer for watchdog()")
Expand Down
Loading

0 comments on commit c3b7a42

Please sign in to comment.