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

depguard new update returns errors on main #4980

Closed
gauron99 opened this issue Sep 18, 2023 · 4 comments · Fixed by #5285
Closed

depguard new update returns errors on main #4980

gauron99 opened this issue Sep 18, 2023 · 4 comments · Fixed by #5285
Labels
stale-bot-ignore All issues that should not be automatically closed by our stale bot

Comments

@gauron99
Copy link
Contributor

gauron99 commented Sep 18, 2023

theres probably some new update for depguard (looks like this happens in versions of golangci-lint of 1.53 and 1.54) validation check and now running pre-commit returns bunch of errors from this checker. See preview below.

Example of running pre-commit

pkg/scaling/resolver/hashicorpvault_handler.go:24:2: import 'github.com/go-logr/logr' is not allowed from list 'Main' (depguard)
	"github.com/go-logr/logr"
	^
pkg/scaling/resolver/hashicorpvault_handler.go:25:2: import 'github.com/hashicorp/vault/api' is not allowed from list 'Main' (depguard)
	vaultapi "github.com/hashicorp/vault/api"
	^
pkg/scaling/resolver/hashicorpvault_handler.go:27:2: import 'github.com/kedacore/keda/v2/apis/keda/v1alpha1' is not allowed from list 'Main' (depguard)
	kedav1alpha1 "github.com/kedacore/keda/v2/apis/keda/v1alpha1"
	^
pkg/scaling/resolver/scale_resolvers.go:26:2: import 'github.com/go-logr/logr' is not allowed from list 'Main' (depguard)
	"github.com/go-logr/logr"
	^
pkg/scaling/resolver/scale_resolvers.go:27:2: import 'k8s.io/api/apps/v1' is not allowed from list 'Main' (depguard)
	appsv1 "k8s.io/api/apps/v1"
	^
pkg/scaling/resolver/scale_resolvers.go:28:2: import 'k8s.io/api/core/v1' is not allowed from list 'Main' (depguard)
	corev1 "k8s.io/api/core/v1"
	^
pkg/scaling/resolver/scale_resolvers.go:29:2: import 'k8s.io/apimachinery/pkg/apis/meta/v1/unstructured' is not allowed from list 'Main' (depguard)
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	^
pkg/scaling/resolver/scale_resolvers.go:30:2: import 'k8s.io/apimachinery/pkg/types' is not allowed from list 'Main' (depguard)
	"k8s.io/apimachinery/pkg/types"
	^
pkg/scaling/resolver/scale_resolvers.go:31:2: import 'k8s.io/client-go/listers/core/v1' is not allowed from list 'Main' (depguard)
	corev1listers "k8s.io/client-go/listers/core/v1"
	^
pkg/scaling/resolver/scale_resolvers.go:32:2: import 'knative.dev/pkg/apis/duck' is not allowed from list 'Main' (depguard)
	"knative.dev/pkg/apis/duck"
	^
pkg/scaling/resolver/scale_resolvers.go:33:2: import 'knative.dev/pkg/apis/duck/v1' is not allowed from list 'Main' (depguard)
	duckv1 "knative.dev/pkg/apis/duck/v1"
	^
pkg/scaling/resolver/scale_resolvers.go:34:2: import 'sigs.k8s.io/controller-runtime/pkg/client' is not allowed from list 'Main' (depguard)
	"sigs.k8s.io/controller-runtime/pkg/client"
	^
pkg/scaling/resolver/scale_resolvers.go:35:2: import 'sigs.k8s.io/controller-runtime/pkg/log' is not allowed from list 'Main' (depguard)
	logf "sigs.k8s.io/controller-runtime/pkg/log"
	^
pkg/scaling/resolver/scale_resolvers.go:38:2: import 'github.com/kedacore/keda/v2/pkg/util' is not allowed from list 'Main' (depguard)
	"github.com/kedacore/keda/v2/pkg/util"
	^
pkg/scaling/resolver/azure_keyvault_handler_test.go:22:2: import 'github.com/Azure/go-autorest/autorest/azure' is not allowed from list 'Main' (depguard)
	az "github.com/Azure/go-autorest/autorest/azure"
@gauron99 gauron99 changed the title depguard depguard new update returns errors on main Sep 18, 2023
Copy link

stale bot commented Nov 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Nov 17, 2023
Copy link

stale bot commented Nov 25, 2023

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Nov 25, 2023
@gauron99
Copy link
Contributor Author

/reopen

@zroubalik zroubalik reopened this Nov 27, 2023
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Nov 27, 2023
@zroubalik zroubalik added the stale-bot-ignore All issues that should not be automatically closed by our stale bot label Nov 27, 2023
@kuritka
Copy link

kuritka commented Jun 11, 2024

Because this was the first link I googled related to depguard, , I'm shaing a quick summary of what it's about:
Depguard defines rules that tell us what imports we can use in our source code. Check out this link to see how to configure it, see: https://golangci-lint.run/usage/linters/#depguard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale-bot-ignore All issues that should not be automatically closed by our stale bot
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants