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

Enable gci linter with automatic fix. Apply lint fixes. #236

Merged
merged 2 commits into from
Jan 10, 2024
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
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
linters:
enable:
- gci

linters-settings:
gci:
sections:
- standard # Standard section: captures all standard packages.
- blank # Blank section: contains all blank imports.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/pulumi/) # Custom section: groups all imports with the github.com/pulumi/ prefix.
- prefix(github.com/pulumi/upgrade-provider) # Custom section: local imports
custom-order: true
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ install:
lint:
golangci-lint run

lint.fix:
golangci-lint run --fix

test:
go test -v ./...
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"strings"

semver "github.com/Masterminds/semver/v3"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"

"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"

"github.com/pulumi/upgrade-provider/colorize"
"github.com/pulumi/upgrade-provider/upgrade"
)
Expand Down
3 changes: 2 additions & 1 deletion step/v2/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import (
"strings"
"testing"

"github.com/pulumi/upgrade-provider/step/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/pulumi/upgrade-provider/step/v2"
)

func TestWithCwd(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion upgrade/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"path/filepath"
"strings"

"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"golang.org/x/mod/modfile"
"golang.org/x/mod/module"

"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"

stepv2 "github.com/pulumi/upgrade-provider/step/v2"
)

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

import (
"context"
"github.com/pulumi/upgrade-provider/step/v2"
"testing"

"github.com/stretchr/testify/assert"
"golang.org/x/mod/modfile"
"golang.org/x/mod/module"
"testing"

"github.com/pulumi/upgrade-provider/step/v2"
)

func TestGetUpstreamProviderOrgFromConfig(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion upgrade/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ import (
"strings"

semver "github.com/Masterminds/semver/v3"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"golang.org/x/mod/modfile"
"golang.org/x/mod/module"
goSemver "golang.org/x/mod/semver"
"gopkg.in/yaml.v3"

"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"

"github.com/pulumi/upgrade-provider/colorize"
"github.com/pulumi/upgrade-provider/step"
stepv2 "github.com/pulumi/upgrade-provider/step/v2"
Expand Down
3 changes: 2 additions & 1 deletion upgrade/steps_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"strings"

"github.com/Masterminds/semver/v3"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
"golang.org/x/mod/modfile"
"golang.org/x/mod/module"

"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"

stepv2 "github.com/pulumi/upgrade-provider/step/v2"
)

Expand Down
3 changes: 2 additions & 1 deletion upgrade/steps_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (

"github.com/Masterminds/semver/v3"
"github.com/hexops/autogold/v2"
"github.com/pulumi/upgrade-provider/step/v2"
"github.com/stretchr/testify/assert"
"golang.org/x/mod/module"

"github.com/pulumi/upgrade-provider/step/v2"
)

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

"github.com/Masterminds/semver/v3"
"github.com/pulumi/upgrade-provider/step/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/pulumi/upgrade-provider/step/v2"
)

func TestGetWorkingBranch(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"testing"

"github.com/Masterminds/semver/v3"
"github.com/pulumi/upgrade-provider/step/v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/mod/module"

"github.com/pulumi/upgrade-provider/step/v2"
)

func TestInformGithub(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions upgrade/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ type Context struct {
//
UpstreamProviderName string
// The org component in the upstream provider's repo path.
//
// This must be provided when upstream is hosted at a repo that does
// not match the Go Module path it is declared as. Otherwise it can
//
// This must be provided when upstream is hosted at a repo that does
// not match the Go Module path it is declared as. Otherwise it can
// be inferred.
//
// For example, if we have an upstream provider with import path:
Expand All @@ -62,7 +62,7 @@ type Context struct {
// github.com/my-org/terraform-provider-my-provider
//
// Then UpstreamProviderOrg should be `my-org`.
UpstreamProviderOrg string
UpstreamProviderOrg string

// The desired version of pulumi/{pkg,sdk} to link to.
//
Expand Down
Loading