Aks-engine: Remove panics within the codebase

Created on 24 Oct 2019  路  8Comments  路  Source: Azure/aks-engine

There are quite a few areas where we panic and we really shouldn't. There are some good reasons to panic, but they are few. The majority of the places where we panic, it's uncalled for.

For example, the method below should return the error rather than panic.
https://github.com/Azure/aks-engine/blob/103ffc90786655cf16d6ef0805904566d74f38fc/pkg/engine/template_generator.go#L223-L241

The codebase has 34 panics in 10 files. If there is a panic, we should probably have a comment why the panic exists and document the panic on public interfaces where a panic is possible.

bug stale

All 8 comments

Hi David.. Can I pick this up and work on this?

Heck, yeah! Thank you!

I was trying to setup my local dev environment on Windows and ran into the following error..

C:\Users\rapurush\go\src\github.com\Azure\aks-engine>make bootstrap The system cannot find the path specified. The system cannot find the path specified. 'test' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. The system cannot find the path specified. make -C hack/tools/ make[1]: Entering directory 'C:/Users/rapurush/go/src/github.com/Azure/aks-engine/hack/tools' process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:7: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:7: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:7: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:7: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:10: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:13: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:16: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:19: pipe: No error process_begin: CreateProcess(NULL, pwd, ...) failed. make[1]: Makefile:11: pipe: No such file or directory GOBIN=/bin go get github.com/go-bindata/go-bindata/[email protected] 'GOBIN' is not recognized as an internal or external command, operable program or batch file. make[1]: *** [Makefile:11: /bin/go-bindata] Error 1 make[1]: Leaving directory 'C:/Users/rapurush/go/src/github.com/Azure/aks-engine/hack/tools' make: *** [Makefile:191: tools-install] Error 2

I switched to using WSL2 on Windows... On ubuntu - i had to make the following changes to successfully setup the dev environment..

  1. Remove $(GOFLAGS) from bootstrap and go-build
  2. Remove specific versions from go get commands for go-bindata, gox, ginkgo

Not sure if this is something that is an issue to others also. But wanted to share just in case...

Might find it easier to run make dev, which will startup a docker dev container which is how our Windows folks usually dev.

@marosset do you have any guidance here?

If you have Docker desktop edition installed you can set it to run linux containers and then run .\makedev.ps1 from the repo root to start the same docker dev container @devigned is mentioning above.
You can run 'make build-cross' to generate the windows executable.

Like @devigned mentioned above you'll probably have the best experience by building using our dev container (which all out build pipelines also use). This should work in WSL on Windows too

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

/label backlog

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

Was this page helpful?
0 / 5 - 0 ratings