remove 'master workspace'
This commit is contained in:
parent
439c94edd2
commit
c400b82983
18
conf/wide.go
18
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())...)
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
"MaxProcs": 4,
|
||||
"RuntimeMode": "dev",
|
||||
"WD": "${pwd}",
|
||||
"Workspace": "${GOPATH}",
|
||||
"Locale": "en_US",
|
||||
"Users": [
|
||||
{
|
||||
|
@ -31,6 +30,6 @@
|
|||
"Files": [],
|
||||
"CurrentFile": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in New Issue