This commit is contained in:
Liang Ding 2015-08-05 12:58:39 +08:00
parent aa454d7513
commit 4b41e905f6
9 changed files with 36 additions and 38 deletions

View File

@ -3,18 +3,17 @@ MAINTAINER Liang Ding <dl88250@gmail.com>
ADD . /wide/gogogo/src/github.com/b3log/wide ADD . /wide/gogogo/src/github.com/b3log/wide
RUN tar zxf /wide/gogogo/src/github.com/b3log/wide/docker-deps/golang.org.tar.gz -C /wide/gogogo/src/ RUN tar zxf /wide/gogogo/src/github.com/b3log/wide/deps/golang.org.tar.gz -C /wide/gogogo/src/
RUN mkdir /wide/gogogo/src/github.com/88250 RUN tar zxf /wide/gogogo/src/github.com/b3log/wide/deps/github.com.tar.gz -C /wide/gogogo/src/
RUN tar zxf /wide/gogogo/src/github.com/b3log/wide/docker-deps/ide_stub.tar.gz -C /wide/gogogo/src/github.com/88250/
RUN useradd wide && useradd runner RUN useradd wide && useradd runner
ENV GOROOT /usr/src/go ENV GOROOT /usr/src/go
ENV GOPATH /wide/gogogo ENV GOPATH /wide/gogogo
RUN go get -v github.com/88250/ide_stub github.com/nsf/gocode github.com/bradfitz/goimports RUN go get github.com/visualfc/gotools github.com/nsf/gocode github.com/bradfitz/goimports
WORKDIR /wide/gogogo/src/github.com/b3log/wide WORKDIR /wide/gogogo/src/github.com/b3log/wide
RUN go get -v && go build -v RUN go get && go build -v
EXPOSE 7070 EXPOSE 7070

View File

@ -96,7 +96,7 @@ Flow:
Flow: Flow:
1. Browser sends code assist request 1. Browser sends code assist request
2. Handler gets user workspace of the request with HTTP session 2. Handler gets user workspace of the request with HTTP session
3. Server executes ````gocode````/````ide_stub````<br/> 3. Server executes ````gocode````/````ide_stub(gotools)````<br/>
3.1 Sets environment variables (e.g. ${GOPATH})<br/> 3.1 Sets environment variables (e.g. ${GOPATH})<br/>
3.2 ````gocode```` with ````lib-path```` parameter 3.2 ````gocode```` with ````lib-path```` parameter
@ -122,8 +122,7 @@ Download [HERE](http://pan.baidu.com/s/1dD3XwOT)!
1. [Download](https://github.com/b3log/wide/archive/master.zip) source or by `git clone https://github.com/b3log/wide` 1. [Download](https://github.com/b3log/wide/archive/master.zip) source or by `git clone https://github.com/b3log/wide`
2. Get dependencies with 2. Get dependencies with
* `go get` * `go get`
* `go get github.com/88250/ide_stub` * `go get go get github.com/visualfc/gotools github.com/nsf/gocode github.com/bradfitz/goimports`
* `go get github.com/nsf/gocode`
3. Compile wide with `go build` 3. Compile wide with `go build`
### Docker ### Docker

View File

@ -286,13 +286,13 @@ func checkEnv() {
logger.Warnf("Not found gocode [%s], please install it with this command: go get github.com/nsf/gocode", gocode) logger.Warnf("Not found gocode [%s], please install it with this command: go get github.com/nsf/gocode", gocode)
} }
ideStub := util.Go.GetExecutableInGOBIN("ide_stub") ideStub := util.Go.GetExecutableInGOBIN("gotools")
cmd = exec.Command(ideStub, "version") cmd = exec.Command(ideStub, "version")
_, err = cmd.Output() _, err = cmd.Output()
if nil != err { if nil != err {
event.EventQueue <- &event.Event{Code: event.EvtCodeIDEStubNotFound} event.EventQueue <- &event.Event{Code: event.EvtCodeIDEStubNotFound}
logger.Warnf("Not found ide_stub [%s], please install it with this command: go get github.com/88250/ide_stub", ideStub) logger.Warnf("Not found gotools [%s], please install it with this command: go get github.com/visualfc/gotools", ideStub)
} }
} }

BIN
deps/github.com.zip vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@ -223,7 +223,7 @@ func GetExprInfoHandler(w http.ResponseWriter, r *http.Request) {
logger.Tracef("offset [%d]", offset) logger.Tracef("offset [%d]", offset)
ideStub := util.Go.GetExecutableInGOBIN("ide_stub") ideStub := util.Go.GetExecutableInGOBIN("gotools")
argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-info", "."} argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-info", "."}
cmd := exec.Command(ideStub, argv...) cmd := exec.Command(ideStub, argv...)
cmd.Dir = curDir cmd.Dir = curDir
@ -299,7 +299,7 @@ func FindDeclarationHandler(w http.ResponseWriter, r *http.Request) {
logger.Tracef("offset [%d]", offset) logger.Tracef("offset [%d]", offset)
ideStub := util.Go.GetExecutableInGOBIN("ide_stub") ideStub := util.Go.GetExecutableInGOBIN("gotools")
argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-def", "."} argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-def", "."}
cmd := exec.Command(ideStub, argv...) cmd := exec.Command(ideStub, argv...)
cmd.Dir = curDir cmd.Dir = curDir
@ -384,7 +384,7 @@ func FindUsagesHandler(w http.ResponseWriter, r *http.Request) {
offset := getCursorOffset(code, line, ch) offset := getCursorOffset(code, line, ch)
logger.Tracef("offset [%d]", offset) logger.Tracef("offset [%d]", offset)
ideStub := util.Go.GetExecutableInGOBIN("ide_stub") ideStub := util.Go.GetExecutableInGOBIN("gotools")
argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-use", "."} argv := []string{"types", "-pos", filename + ":" + strconv.Itoa(offset), "-use", "."}
cmd := exec.Command(ideStub, argv...) cmd := exec.Command(ideStub, argv...)
cmd.Dir = curDir cmd.Dir = curDir

View File

@ -29,7 +29,7 @@ const (
EvtCodeGOROOTNotFound EvtCodeGOROOTNotFound
// EvtCodeGocodeNotFound indicates an event: not found gocode // EvtCodeGocodeNotFound indicates an event: not found gocode
EvtCodeGocodeNotFound EvtCodeGocodeNotFound
// EvtCodeIDEStubNotFound indicates an event: not found ide_stub // EvtCodeIDEStubNotFound indicates an event: not found gotools
EvtCodeIDEStubNotFound EvtCodeIDEStubNotFound
// EvtCodeServerInternalError indicates an event: server internal error // EvtCodeServerInternalError indicates an event: server internal error
EvtCodeServerInternalError EvtCodeServerInternalError

48
pkg.sh
View File

@ -22,22 +22,22 @@ os=darwin
export GOOS=${os} export GOOS=${os}
export GOARCH=386 export GOARCH=386
go build go build
go build github.com/88250/ide_stub go build github.com/visualfc/gotools
go build github.com/nsf/gocode go build github.com/nsf/gocode
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/ide_stub . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gotools .
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode .
tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} ide_stub gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go' tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} gotools gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go'
rm -f wide ide_stub gocode rm -f wide gotools gocode
export GOOS=${os} export GOOS=${os}
export GOARCH=amd64 export GOARCH=amd64
go build go build
go build github.com/88250/ide_stub go build github.com/visualfc/gotools
go build github.com/nsf/gocode go build github.com/nsf/gocode
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/ide_stub . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gotools .
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode .
tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} ide_stub gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go' tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} gotools gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go'
rm -f wide ide_stub gocode rm -f wide gotools gocode
## linux ## linux
os=linux os=linux
@ -45,22 +45,22 @@ os=linux
export GOOS=${os} export GOOS=${os}
export GOARCH=386 export GOARCH=386
go build go build
go build github.com/88250/ide_stub go build github.com/visualfc/gotools
go build github.com/nsf/gocode go build github.com/nsf/gocode
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/ide_stub . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gotools .
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode .
tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} ide_stub gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go' tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} gotools gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go'
rm -f wide ide_stub gocode rm -f wide gotools gocode
export GOOS=${os} export GOOS=${os}
export GOARCH=amd64 export GOARCH=amd64
go build go build
go build github.com/88250/ide_stub go build github.com/visualfc/gotools
go build github.com/nsf/gocode go build github.com/nsf/gocode
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/ide_stub . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gotools .
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode .
tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} ide_stub gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go' tar zcvf ${target}/wide-${ver}-${GOOS}-${GOARCH}.tar.gz ${list} gotools gocode wide --exclude-vcs --exclude='conf/*.go' --exclude='i18n/*.go'
rm -f wide ide_stub gocode rm -f wide gotools gocode
## windows ## windows
os=windows os=windows
@ -68,20 +68,20 @@ os=windows
export GOOS=${os} export GOOS=${os}
export GOARCH=386 export GOARCH=386
go build go build
go build github.com/88250/ide_stub go build github.com/visualfc/gotools
go build github.com/nsf/gocode go build github.com/nsf/gocode
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/ide_stub.exe . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gotools.exe .
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode.exe . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode.exe .
zip -r ${target}/wide-${ver}-${GOOS}-${GOARCH}.zip ${list} ide_stub.exe gocode.exe wide.exe --exclude=conf/*.go --exclude=i18n/*.go zip -r ${target}/wide-${ver}-${GOOS}-${GOARCH}.zip ${list} gotools.exe gocode.exe wide.exe --exclude=conf/*.go --exclude=i18n/*.go
rm -f wide.exe ide_stub.exe gocode.exe rm -f wide.exe gotools.exe gocode.exe
export GOOS=${os} export GOOS=${os}
export GOARCH=amd64 export GOARCH=amd64
go build go build
go build github.com/88250/ide_stub go build github.com/visualfc/gotools
go build github.com/nsf/gocode go build github.com/nsf/gocode
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/ide_stub.exe . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gotools.exe .
cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode.exe . cp ${GOPATH}/bin/${GOOS}_${GOARCH}/gocode.exe .
zip -r ${target}/wide-${ver}-${GOOS}-${GOARCH}.zip ${list} ide_stub.exe gocode.exe wide.exe --exclude=conf/*.go --exclude=i18n/*.go zip -r ${target}/wide-${ver}-${GOOS}-${GOARCH}.zip ${list} gotools.exe gocode.exe wide.exe --exclude=conf/*.go --exclude=i18n/*.go
rm -f wide.exe ide_stub.exe gocode.exe rm -f wide.exe gotools.exe gocode.exe