satellite/admin: Move declaration before first usage
Move a variable declaration just before where is used for making easy to follow the implementation when reading it. Change-Id: I3e93597956352037a63c5496b11576fdd2c600a6
This commit is contained in:
parent
3e040767b4
commit
df44e8152d
@ -47,10 +47,6 @@ func (server *Server) addAPIKey(w http.ResponseWriter, r *http.Request) {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
var output struct {
|
||||
APIKey string `json:"apikey"`
|
||||
}
|
||||
|
||||
err = json.Unmarshal(body, &input)
|
||||
if err != nil {
|
||||
sendJSONError(w, "failed to unmarshal request",
|
||||
@ -99,6 +95,10 @@ func (server *Server) addAPIKey(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
var output struct {
|
||||
APIKey string `json:"apikey"`
|
||||
}
|
||||
|
||||
output.APIKey = key.Serialize()
|
||||
data, err := json.Marshal(output)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user