Closed afritzler closed 1 year ago
@afritzler Thank you for your contribution.
What is the reasoning behind forbidding dot imports?
./pkg/test/integration/common/framework.go:18:2: should not use dot imports
./pkg/test/integration/common/framework.go:19:2: should not use dot imports
./pkg/test/integration/common/framework.go:20:2: should not use dot imports
In the context of gomega
and ginkgo
dot imports IMO are pretty handy.
In the context of gomega and ginkgo dot imports IMO are pretty handy.
I agree, it should not be removed in tests. It should however not be used in non-test code.
should not use dot imports
For now I don't find any way to add it as an exception to golint
. We will switch to golangci-lint where we could configure for this particular error.
For the time being lets avoid dot imports @afritzler . Kindly update the PR , I'll merge it quickly.
Regarding the dot-imports. I can revert this part. Didn't mean to break things on your side.
kindly also remove the dot imports for now, as we don't have a way to ignore those in golint
Just to add to this point. We are not against usage of dot-imports in tests as it is widely used across several gardener projects and is also listed as an exception to the general rule for using dot-imports. See https://go.dev/doc/go1compat
Dot imports. If a program imports a standard package using import . "path", additional names defined in the imported package in future releases may conflict with other names defined in the program. We do not recommend the use of import . outside of tests, and using it may cause a program to fail to compile in future releases.
https://github.com/golang/lint is deprecated and once we move to golangci-lint
then we can explicitly add a rule to allow dot-imports in tests. Till then just have a shorter alias for ginkgo and gomega.
Regarding the dot-imports. I can revert this part. Didn't mean to break things on your side. @afritzler waiting for your changes. We are planning a release , and would like to get this change in.
Give me a sec here.
Dot imports have been removed and the branch has been rebased to master
.
@himanshu-kun I am not sure I like this change as it now includes the gardener/gardener
dependency which results in a huge PR. change.
@himanshu-kun I am not sure I like this change as it now includes the
gardener/gardener
dependency which results in a huge PR. change.
Yes definitely, we shouldn't add g/g as dependency. My proposal was more towards copying the relevant code from g/g in some util file, so that we could use the matcher
Alright, I copied the matches over into test/utils/matchers
.
/milestone v0.49
What this PR does / why we need it: Fix linting issues in
test
,handlers
andfeatures
packages.Release note: