Writing your first operator tutorial
  • 👋Welcome!
    • 🙋Questions?
    • 🎁Feedback
  • 📑Content
    • 💻Online tutorial
      • 🎃Instruqt tips and tricks
      • 🖇️Open Source content
    • 📃Slide deck
    • 🎶Background tunes
  • ⁉️Errors
    • Rate limit on docker pull abangser/todo
    • Rate limit on `make install`
    • The `newDeployment` function is missing
    • "Connection closed" warning in Instruqt
    • Instruqt is showing `Unauthorized` instead of a console or VSCode
    • Errors happen when I click `Check`
    • `make run` fails with port 8080 already in in use
    • `make run` errors during fmt or vet stage
Powered by GitBook
On this page
  • An example error
  • Fixing the issue
  1. Errors

`make run` errors during fmt or vet stage

An example error

When you run make run it will first run go fmt and go vet. If either of these commands find issues you will see an error like this:

root@kubernetes-vm:~/demo# make run
test -s /root/demo/bin/controller-gen || GOBIN=/root/demo/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.2
/root/demo/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/root/demo/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
# my.domain/controllers
controllers/website_controller.go:78:6: undefined: errors
controllers/website_controller.go:89:6: undefined: errors
# my.domain/controllers
vet: controllers/website_controller.go:78:6: undeclared name: errors
make: *** [Makefile:55: vet] Error 2

Fixing the issue

go fmt should be run on save in the Code editor. If you chose to edit the files in a different way (e.g. via vim) it would be easiest to open the file in the Code editor tab, make a small white space change (e.g. enter an extra new line somewhere) and then save the file using ctrl+s (or cmd+s on a mac).

If you want to continue using another editor, make sure to run the appropriate fmt commands prior to running make run.

Previous`make run` fails with port 8080 already in in use

Last updated 2 years ago

⁉️