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

Goimports error in Travis #1303

Closed
Adirio opened this issue Jan 11, 2020 · 6 comments
Closed

Goimports error in Travis #1303

Adirio opened this issue Jan 11, 2020 · 6 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@Adirio
Copy link
Contributor

Adirio commented Jan 11, 2020

Travis is failing several PR due to a goimports linting error. The error message is:

$ ./scripts/verify.sh
running go vet
running go fmt
running golangci-lint
pkg/scaffold/v2/controller/controller_suitetest.go:26: File is not goimports-ed (goimports)
"sigs.k8s.io/kubebuilder/pkg/scaffold/v2"
The command "./scripts/verify.sh" exited with 1.

Affected PR:

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 11, 2020
@Adirio
Copy link
Contributor Author

Adirio commented Jan 11, 2020

#1186 and #1252 do modify that file and #1186 doesn't even touch the import section. Additionally, #1248 and #1265 do not modify that file at all, so the error doesn't seem to be related to anything done in those PR.

The check has been introduced in #1292 and #1198 is the only thing that was merged into master between #1292 branch start and its merge. I have tried to run gofmt and goimports to that file and they do not modify anything.

@camilamacedo86 Could you please have a look at this as my linter is warning about less things than yours?

@camilamacedo86
Copy link
Member

camilamacedo86 commented Jan 12, 2020

@Adirio,

The error faced is:

Screenshot 2020-01-12 at 12 11 41

Note that you can use the lint to fix it automatically by adding the flag fix as follows and the running the lint target make lint

Screenshot 2020-01-12 at 12 17 35

@Adirio
Copy link
Contributor Author

Adirio commented Jan 12, 2020

Why does it need to use v2 as import alias if the package is already called v2?

@camilamacedo86
Copy link
Member

Hi @Adirio the lint checks are usually based in good practices. I understand that it is suggesting to add the alias in order to make implicit that it came from v2 and not another version. However, I did not check it further. Please, feel free to look for its explanation in its doc and implementation which is here: https://godoc.org/github.com/Go-zh/tools/cmd/goimports.

@camilamacedo86
Copy link
Member

Hi @Adirio,

It is fixed. Could we close this one? If not, what is missing to address here?

@Adirio Adirio closed this as completed Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants