build/all.bash: install gocode-gomode

github.com/stamblerre/gocode, gocode for module mode.
Module mode will be the default in go1.16, and some tests
for legacy language feature providers need this.

For golang/vscode-go#983

Change-Id: I30ebdc33a6aa97faead69c8d5dfa6cc8c97aeec0
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/291309
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/build/all.bash b/build/all.bash
index 2a83163..05bf37d 100755
--- a/build/all.bash
+++ b/build/all.bash
@@ -93,12 +93,22 @@
 
 # setup dependencies required for tests.
 install_dependencies() {
+	# TARGET is where `go get` will output the compiled binaries.
+	local GOPATHS=`go env GOPATH`
+	local TARGET="${GOBIN}"
+	if [[ -z "${GOBIN}" ]]; then TARGET="${GOPATHS%%:*}/bin" ; fi
+
 	GO111MODULE=on go get golang.org/x/tools/gopls
 	GO111MODULE=on go get github.com/acroca/go-symbols
 	GO111MODULE=on go get github.com/cweill/gotests/...
 	GO111MODULE=on go get github.com/davidrjenni/reftools/cmd/fillstruct
 	GO111MODULE=on go get github.com/haya14busa/goplay/cmd/goplay
+
+	# We install two versions of gocode, one for module mode (gocode-gomod)
+	# and another for GOPATH mode (gocode).
+	GO111MODULE=on go get github.com/stamblerre/gocode && mv "${TARGET}/gocode" "${TARGET}/gocode-gomod"
 	GO111MODULE=on go get github.com/mdempsky/gocode
+
 	GO111MODULE=on go get github.com/ramya-rao-a/go-outline
 	GO111MODULE=on go get github.com/rogpeppe/godef
 	GO111MODULE=on go get github.com/sqs/goreturns