go formmat

This commit is contained in:
Liang Ding 2014-11-13 22:28:28 +08:00
parent 5c341e18c3
commit 93f6958b9c
1 changed files with 6 additions and 4 deletions

View File

@ -1,11 +1,11 @@
// Copyright (c) 2014, B3log // Copyright (c) 2014, B3log
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -84,7 +84,9 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
bytes, _ := cmd.Output() bytes, _ := cmd.Output()
output := string(bytes) output := string(bytes)
if "" == output { if "" == output {
data["succ"] = false // format error, returns the original content
data["succ"] = true
data["code"] = code
return return
} }