delete duplicate import and use ST1019 in golangci-lint (#17211)

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
This commit is contained in:
Abirdcfly 2022-07-25 14:12:00 +08:00 committed by GitHub
parent e9855a88dd
commit 2fece8c9ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -7,6 +7,10 @@ linters-settings:
locale: US,UK
goimports:
local-prefixes: github.com/goharbor/harbor
stylecheck:
checks: [
"ST1019", # Importing the same package multiple times.
]
linters:
disable-all: true
@ -40,7 +44,7 @@ linters:
# - rowserrcheck
# - staticcheck
- structcheck
# - stylecheck
- stylecheck
# - unconvert
# - unparam
- unused

View File

@ -27,7 +27,6 @@ import (
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notifier/model"
notifyModel "github.com/goharbor/harbor/src/pkg/notifier/model"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
)
@ -91,7 +90,7 @@ func (a *Handler) handle(ctx context.Context, event *event.ArtifactEvent) error
return nil
}
func (a *Handler) constructArtifactPayload(event *event.ArtifactEvent, project *proModels.Project) (*model.Payload, error) {
func (a *Handler) constructArtifactPayload(event *event.ArtifactEvent, project *proModels.Project) (*notifyModel.Payload, error) {
repoName := event.Repository
if repoName == "" {
return nil, fmt.Errorf("invalid %s event with empty repo name", event.EventType)

View File

@ -25,7 +25,6 @@ import (
"github.com/goharbor/harbor/src/lib/log"
"github.com/goharbor/harbor/src/lib/orm"
"github.com/goharbor/harbor/src/pkg/notification"
"github.com/goharbor/harbor/src/pkg/notifier/model"
notifyModel "github.com/goharbor/harbor/src/pkg/notifier/model"
proModels "github.com/goharbor/harbor/src/pkg/project/models"
)
@ -82,7 +81,7 @@ func (qp *Handler) IsStateful() bool {
return false
}
func constructQuotaPayload(event *event.QuotaEvent) (*model.Payload, error) {
func constructQuotaPayload(event *event.QuotaEvent) (*notifyModel.Payload, error) {
repoName := event.RepoName
if repoName == "" {
return nil, fmt.Errorf("invalid %s event with empty repo name", event.EventType)