Panicing if not running in a test and if the component-base/version variables are empty is not ideal. At some point sections of kubeadm could be exposed as a library and if these sections import the constants package, they would panic on the library users unless they set the version information in component-base with ldflags. Instead: - If the component-base version is empty, return a placeholder version that should indicate to users that build kubeadm that something is not right (e.g. they did not use 'make'). During library usage or unit tests this version should not be relevant. - Update unit tests to use hardcoded versions instead of the versions from the constants package. Using the constants package for testing is good but during unit tests these versions are already placeholders since unit tests do not populate the actual component-base versions (e.g. 1.23).
9.2 KiB
9.2 KiB