diff --git a/conf/wide.go b/conf/wide.go index 7d38c19..c0c63c9 100644 --- a/conf/wide.go +++ b/conf/wide.go @@ -67,7 +67,6 @@ type conf struct { MaxProcs int // Go max procs RuntimeMode string // runtime mode (dev/prod) WD string // current working direcitory, ${pwd} - Workspace string // path of master workspace Locale string // default locale Users []*User // configurations of users } @@ -148,19 +147,6 @@ func (c *conf) GetUserWorkspace(username string) string { return "" } -// GetWorkspace gets the master workspace path. -// -// Compared to the use of Wide.Workspace, this function will be processed as follows: -// 1. Replace {WD} variable with the actual directory path -// 2. Replace ${GOPATH} with enviorment variable GOPATH -// 3. Replace "/" with "\\" (Windows) -func (c *conf) GetWorkspace() string { - w := strings.Replace(c.Workspace, "{WD}", c.WD, 1) - w = strings.Replace(w, "${GOPATH}", os.Getenv("GOPATH"), 1) - - return filepath.FromSlash(w) -} - // GetGoFmt gets the path of Go format tool, returns "gofmt" if not found. func (c *conf) GetGoFmt(username string) string { for _, user := range c.Users { @@ -359,11 +345,11 @@ func UpdateCustomizedConf(username string) { } } -// initWorkspaceDirs initializes the directories of master workspace, users' workspaces. +// initWorkspaceDirs initializes the directories of users' workspaces. // // Creates directories if not found on path of workspace. func initWorkspaceDirs() { - paths := filepath.SplitList(Wide.GetWorkspace()) + paths := []string{} for _, user := range Wide.Users { paths = append(paths, filepath.SplitList(user.GetWorkspace())...) diff --git a/conf/wide.json b/conf/wide.json index 1a3f4ec..a3eb60e 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -11,7 +11,6 @@ "MaxProcs": 4, "RuntimeMode": "dev", "WD": "${pwd}", - "Workspace": "${GOPATH}", "Locale": "en_US", "Users": [ { @@ -31,6 +30,6 @@ "Files": [], "CurrentFile": "" } - } + } ] } \ No newline at end of file diff --git a/file/files.go b/file/files.go index 1c4f994..84ff8a3 100644 --- a/file/files.go +++ b/file/files.go @@ -345,7 +345,14 @@ func listFiles(dirname string) []string { // sort: directories in front of files for _, name := range names { - fio, _ := os.Lstat(filepath.Join(dirname, name)) + path := filepath.Join(dirname, name) + fio, err := os.Lstat(path) + + if nil != err { + glog.Warningf("Can't read file info [%s]", path) + + continue + } if fio.IsDir() { // exclude the .git direcitory diff --git a/output/outputs.go b/output/outputs.go index 943b152..9dfcd7e 100644 --- a/output/outputs.go +++ b/output/outputs.go @@ -846,10 +846,9 @@ func StopHandler(w http.ResponseWriter, r *http.Request) { func setCmdEnv(cmd *exec.Cmd, username string) { userWorkspace := conf.Wide.GetUserWorkspace(username) - masterWorkspace := conf.Wide.GetWorkspace() cmd.Env = append(cmd.Env, - "GOPATH="+userWorkspace+conf.PathListSeparator+masterWorkspace, + "GOPATH="+userWorkspace, "GOOS="+runtime.GOOS, "GOARCH="+runtime.GOARCH, "GOROOT="+runtime.GOROOT(),