acoustic-carpenter-78188
10/10/2023, 10:21 PMgoimports orders imports within a block and optionally breaks them into standard, default, and third party packages, but it does not reformat already broken import blocks. There is a long discussion about this behavior here. As an alternative gci will ensure that go imports are grouped into exactly the sections requested.
This change
• updates make goimports to run gci to format goimports into three sections: standard, default, and flyteorg
• adds gci as a linter for golangci-lint, which is run using make run
For an example of the formatted output of make goimports, see this dry run for flyteplugins
For instance, before:
import (
"context"
"testing"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core/mocks"
"gotest.tools/assert"
)
After:
import (
"context"
"testing"
"gotest.tools/assert"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core"
"github.com/flyteorg/flyte/flyteplugins/go/tasks/pluginmachinery/core/mocks"
)
flyteorg/boilerplate
✅ All checks have passed
2/2 successful checksacoustic-carpenter-78188
10/13/2023, 10:51 PM