Skip to content

Commit

Permalink
Don't use Infof to print constant strings
Browse files Browse the repository at this point in the history
logging.Info is enough to print strings which are not format strings.
  • Loading branch information
cfergeau authored and praveenkumar committed Apr 28, 2020
1 parent 511e4ff commit b3ad76c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/crc/machine/machine.go
Expand Up @@ -144,7 +144,7 @@ func Start(startConfig StartConfig) (StartResult, error) {

openshiftVersion := crcBundleMetadata.GetOpenshiftVersion()
if openshiftVersion == "" {
logging.Infof("Creating VM...")
logging.Info("Creating VM...")
} else {
logging.Infof("Creating CodeReady Containers VM for OpenShift %s...", openshiftVersion)
}
Expand Down Expand Up @@ -199,7 +199,7 @@ func Start(startConfig StartConfig) (StartResult, error) {
if IsRunning(vmState) {
openshiftVersion := crcBundleMetadata.GetOpenshiftVersion()
if openshiftVersion == "" {
logging.Infof("A CodeReady Containers VM is already running")
logging.Info("A CodeReady Containers VM is already running")
} else {
logging.Infof("A CodeReady Containers VM for OpenShift %s is already running", openshiftVersion)
}
Expand All @@ -208,7 +208,7 @@ func Start(startConfig StartConfig) (StartResult, error) {
} else {
openshiftVersion := crcBundleMetadata.GetOpenshiftVersion()
if openshiftVersion == "" {
logging.Infof("Starting CodeReady Containers VM ...")
logging.Info("Starting CodeReady Containers VM ...")
} else {
logging.Infof("Starting CodeReady Containers VM for OpenShift %s...", openshiftVersion)
}
Expand Down Expand Up @@ -323,7 +323,7 @@ func Start(startConfig StartConfig) (StartResult, error) {
result.Error = err.Error()
return *result, errors.Newf("Failed internal DNS query: %v : %s", err, queryOutput)
}
logging.Infof("Check internal and public DNS query ...")
logging.Info("Check internal and public DNS query ...")

if queryOutput, err := dns.CheckCRCPublicDNSReachable(servicePostStartConfig); err != nil {
logging.Warnf("Failed public DNS query from the cluster: %v : %s", err, queryOutput)
Expand All @@ -344,7 +344,7 @@ func Start(startConfig StartConfig) (StartResult, error) {
}
// Copy Kubeconfig file from bundle extract path to machine directory.
// In our case it would be ~/.crc/machines/crc/
logging.Infof("Copying kubeconfig file to instance dir ...")
logging.Info("Copying kubeconfig file to instance dir ...")
kubeConfigFilePath := filepath.Join(constants.MachineInstanceDir, startConfig.Name, "kubeconfig")
err := crcos.CopyFileContents(crcBundleMetadata.GetKubeConfigPath(),
kubeConfigFilePath,
Expand All @@ -356,7 +356,7 @@ func Start(startConfig StartConfig) (StartResult, error) {
}

if needsCertsRenewal {
logging.Infof("Cluster TLS certificates have expired, renewing them... [will take up to 5 minutes]")
logging.Info("Cluster TLS certificates have expired, renewing them... [will take up to 5 minutes]")
err = RegenerateCertificates(sshRunner, startConfig.Name)
if err != nil {
result.Error = err.Error()
Expand Down Expand Up @@ -407,7 +407,7 @@ func Start(startConfig StartConfig) (StartResult, error) {
return *result, errors.New(err.Error())
}

logging.Infof("Starting OpenShift cluster ... [waiting 3m]")
logging.Info("Starting OpenShift cluster ... [waiting 3m]")
}
result.KubeletStarted = kubeletStarted

Expand All @@ -426,12 +426,12 @@ func Start(startConfig StartConfig) (StartResult, error) {

// If no error, return usage message
if result.Error == "" {
logging.Infof("")
logging.Infof("To access the cluster, first set up your environment by following 'crc oc-env' instructions")
logging.Info("")
logging.Info("To access the cluster, first set up your environment by following 'crc oc-env' instructions")
logging.Infof("Then you can access it by running 'oc login -u developer -p developer %s'", result.ClusterConfig.ClusterAPI)
logging.Infof("To login as an admin, run 'oc login -u kubeadmin -p %s %s'", result.ClusterConfig.KubeAdminPass, result.ClusterConfig.ClusterAPI)
logging.Infof("")
logging.Infof("You can now run 'crc console' and use these credentials to access the OpenShift web console")
logging.Info("")
logging.Info("You can now run 'crc console' and use these credentials to access the OpenShift web console")
}

return *result, err
Expand Down

0 comments on commit b3ad76c

Please sign in to comment.