Просмотр исходного кода

Fix linting errors and remove useless code

Alan Christopher Thomas 7 лет назад
Родитель
Сommit
21baa69473
1 измененных файлов с 8 добавлено и 9 удалено
  1. 8 9
      cmd/step-ca/main.go

+ 8 - 9
cmd/step-ca/main.go

@@ -26,8 +26,8 @@ import (
 )
 )
 
 
 type config struct {
 type config struct {
-	Name string `json:"name"`
-	DNS string `json:"dns"`
+	Name    string `json:"name"`
+	DNS     string `json:"dns"`
 	Address string `json:"address"`
 	Address string `json:"address"`
 }
 }
 type onboardingPayload struct {
 type onboardingPayload struct {
@@ -225,18 +225,18 @@ intermediate private key.`,
 				// TODO actually initialize the CA config and start listening
 				// TODO actually initialize the CA config and start listening
 				// TODO get the root cert fingerprint to post back to the onboarding guide
 				// TODO get the root cert fingerprint to post back to the onboarding guide
 				payload, err := json.Marshal(onboardingPayload{Fingerprint: "foobarbatbaz"})
 				payload, err := json.Marshal(onboardingPayload{Fingerprint: "foobarbatbaz"})
-				req, err := http.NewRequest("POST", "http://localhost:3002/onboarding/" + token, bytes.NewBuffer(payload))
-				req.Header.Set("Content-Type", "application/json")
 				if err != nil {
 				if err != nil {
 					log.Fatal(err)
 					log.Fatal(err)
 				}
 				}
 
 
-				client := &http.Client{}
-				resp, err := client.Do(req)
+				req, err := http.NewRequest("POST", "http://localhost:3002/onboarding/"+token, bytes.NewBuffer(payload))
+				req.Header.Set("Content-Type", "application/json")
 				if err != nil {
 				if err != nil {
 					log.Fatal(err)
 					log.Fatal(err)
 				}
 				}
-				body, err = ioutil.ReadAll(resp.Body)
+
+				client := &http.Client{}
+				resp, err := client.Do(req)
 				if err != nil {
 				if err != nil {
 					log.Fatal(err)
 					log.Fatal(err)
 				}
 				}
@@ -245,9 +245,8 @@ intermediate private key.`,
 				fmt.Printf("Initialized!\n")
 				fmt.Printf("Initialized!\n")
 				fmt.Printf("Step CA has been started. Please return to the onboarding guide in your browser to continue.\n")
 				fmt.Printf("Step CA has been started. Please return to the onboarding guide in your browser to continue.\n")
 				for {
 				for {
-					time.Sleep(1 * time.Second);
+					time.Sleep(1 * time.Second)
 				}
 				}
-				return nil
 			},
 			},
 		},
 		},
 		{
 		{