This commit is contained in:
Liang Ding 2014-10-26 16:03:19 +08:00
parent 280b665b86
commit ad75e1088b
1 changed files with 9 additions and 0 deletions

View File

@ -5,8 +5,11 @@ import (
"net/http"
"os"
"os/exec"
"runtime"
"strings"
"github.com/88250/gohtml"
"github.com/b3log/wide/conf"
"github.com/b3log/wide/util"
"github.com/golang/glog"
)
@ -31,6 +34,12 @@ func GoFmtHandler(w http.ResponseWriter, r *http.Request) {
filePath := args["file"].(string)
apiPath := runtime.GOROOT() + conf.PathSeparator + "src" + conf.PathSeparator + "pkg"
if strings.HasPrefix(filePath, apiPath) { // 如果是 Go API 源码文件
// 忽略修改
return
}
fout, err := os.Create(filePath)
if nil != err {