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

[chore] adopt GCI to manage imports #17585

Merged
merged 5 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ jobs:
run: |
make -j2 generate
git diff --exit-code ':!*go.sum' || (echo 'Generated code is out of date, please run "make generate" and commit the changes in this PR.' && exit 1)
- name: Impi
run: make -j2 goimpi
- name: MultimodVerify
run: make multimod-verify
- name: Components dropdown in issue templates
Expand Down
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ output:

# all available settings of specific linters
linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/open-telemetry/opentelemetry-collector-contrib)

govet:
# report about shadowed variables
check-shadowing: true
Expand Down Expand Up @@ -122,6 +128,7 @@ linters:
- errcheck
- errorlint
- exportloopref
- gci
- gocritic
- gofmt
- goimports
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ gofmt:
golint:
$(MAKE) $(FOR_GROUP_TARGET) TARGET="lint"

.PHONY: goimpi
goimpi: $(IMPI)
@$(MAKE) $(FOR_GROUP_TARGET) TARGET="impi"

.PHONY: goporto
goporto: $(PORTO)
$(PORTO) -w --include-internal --skip-dirs "^cmd$$" ./
Expand Down
7 changes: 1 addition & 6 deletions Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ MDLINKCHECK := $(TOOLS_BIN_DIR)/markdown-link-check
MISSPELL := $(TOOLS_BIN_DIR)/misspell -error
MISSPELL_CORRECTION := $(TOOLS_BIN_DIR)/misspell -w
LINT := $(TOOLS_BIN_DIR)/golangci-lint
IMPI := $(TOOLS_BIN_DIR)/impi
MULITMOD := $(TOOLS_BIN_DIR)/multimod
CHLOGGEN := $(TOOLS_BIN_DIR)/chloggen
GOIMPORTS := $(TOOLS_BIN_DIR)/goimports
Expand Down Expand Up @@ -91,7 +90,7 @@ all-pkg-dirs:
.DEFAULT_GOAL := common

.PHONY: common
common: checklicense impi lint misspell
common: checklicense lint misspell

.PHONY: test
test:
Expand Down Expand Up @@ -179,10 +178,6 @@ misspell: $(TOOLS_BIN_DIR)/misspell
misspell-correction: $(TOOLS_BIN_DIR)/misspell
$(MISSPELL_CORRECTION) $(ALL_SRC_AND_DOC)

.PHONY: impi
impi: $(IMPI)
@$(IMPI) --local github.com/open-telemetry/opentelemetry-collector-contrib --scheme stdThirdPartyLocal ./...

.PHONY: moddownload
moddownload:
$(GOCMD) mod download
Expand Down
1 change: 1 addition & 0 deletions exporter/azuremonitorexporter/time_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package azuremonitorexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/azuremonitorexporter"

// Contains code common to both trace and metrics exporters

import (
"fmt"
"time"
Expand Down
1 change: 1 addition & 0 deletions exporter/azuremonitorexporter/trace_to_envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package azuremonitorexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/azuremonitorexporter"

// Contains code common to both trace and metrics exporters

import (
"errors"
"net/url"
Expand Down
1 change: 1 addition & 0 deletions extension/storage/dbstorage/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// +build !windows

package dbstorage // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/dbstorage"

import (
"errors"
"testing"
Expand Down
3 changes: 1 addition & 2 deletions internal/coreinternal/attraction/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
package attraction // import "github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/attraction"

import (
// #nosec
"crypto/sha1"
"crypto/sha1" // #nosec
"encoding/binary"
"encoding/hex"
"math"
Expand Down
3 changes: 1 addition & 2 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ go 1.18

require (
github.com/client9/misspell v0.3.4
github.com/daixiang0/gci v0.9.0
github.com/golangci/golangci-lint v1.50.1
github.com/google/addlicense v1.1.0
github.com/jcchavezs/porto v0.4.0
github.com/jstemmer/go-junit-report v1.0.0
github.com/pavius/impi v0.0.3
github.com/tcnksm/ghr v0.16.0
go.opentelemetry.io/build-tools/checkdoc v0.4.0
go.opentelemetry.io/build-tools/chloggen v0.3.0
Expand Down Expand Up @@ -49,7 +49,6 @@ require (
github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.8.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denis-tingaikin/go-header v0.4.3 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
Expand Down
6 changes: 2 additions & 4 deletions internal/tools/go.sum

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

2 changes: 1 addition & 1 deletion internal/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ package tools // import "github.com/open-telemetry/opentelemetry-collector-contr

import (
_ "github.com/client9/misspell/cmd/misspell"
_ "github.com/daixiang0/gci"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/google/addlicense"
_ "github.com/jcchavezs/porto/cmd/porto"
_ "github.com/jstemmer/go-junit-report"
_ "github.com/pavius/impi/cmd/impi"
_ "github.com/tcnksm/ghr"
_ "go.opentelemetry.io/build-tools/checkdoc"
_ "go.opentelemetry.io/build-tools/chloggen"
Expand Down
1 change: 1 addition & 0 deletions pkg/ottl/grammar.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package ottl // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"

import (
"encoding/hex"
"fmt"
Expand Down
3 changes: 1 addition & 2 deletions pkg/stanza/adapter/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
package adapter // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/adapter"

import (
// Register parsers and transformers for stanza-based log receivers
atoulme marked this conversation as resolved.
Show resolved Hide resolved
_ "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/output/file"
_ "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/output/file" // Register parsers and transformers for stanza-based log receivers
_ "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/output/stdout"
_ "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/csv"
_ "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/json"
Expand Down
1 change: 1 addition & 0 deletions processor/transformprocessor/internal/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package common // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/transformprocessor/internal/common"

import (
"fmt"
"strings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package cwmetricstream // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream"

import (
"fmt"
"strings"
Expand Down
1 change: 1 addition & 0 deletions receiver/azureeventhubreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package azureeventhubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"

import (
"errors"
"fmt"
Expand Down
1 change: 1 addition & 0 deletions receiver/azureeventhubreceiver/persister.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package azureeventhubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"

import (
"context"
"fmt"
Expand Down
1 change: 1 addition & 0 deletions receiver/azureeventhubreceiver/persister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package azureeventhubreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/azureeventhubreceiver"

import (
"context"
"errors"
Expand Down
1 change: 1 addition & 0 deletions receiver/nsxtreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package nsxtreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver"

import (
"context"
"encoding/json"
Expand Down
1 change: 1 addition & 0 deletions receiver/nsxtreceiver/client_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package nsxtreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver"

import (
context "context"
testing "testing"
Expand Down
1 change: 1 addition & 0 deletions receiver/nsxtreceiver/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package nsxtreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver"

import (
"context"
"fmt"
Expand Down
1 change: 1 addition & 0 deletions receiver/nsxtreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

package nsxtreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/nsxtreceiver"

import (
"errors"
"fmt"
Expand Down
1 change: 1 addition & 0 deletions receiver/purefareceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package purefareceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/purefareceiver"

// This file implements Factory for Array scraper.

import (
"context"
"fmt"
Expand Down