update go tooling
authorAJ ONeal <aj@therootcompany.com>
Thu, 1 Oct 2020 20:07:47 +0000 (20:07 +0000)
committerAJ ONeal <aj@therootcompany.com>
Mon, 5 Oct 2020 22:08:00 +0000 (22:08 +0000)
golang/install.sh
vim-go/go.vim
vim-go/install.sh

index 44fd5bee6e7db1bf103d6fa191c50f7319844268..adb6d20cba153f1c37e42a45ef1d0c448cceb62b 100644 (file)
@@ -54,24 +54,41 @@ pkg_post_install() {
 
     # Install x go
     echo "Building go language tools..."
+    export GO111MODULE=on
+
+    echo ""
     echo gopls
-    "$pkg_dst_cmd" get golang.org/x/tools/gopls > /dev/null #2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/gopls@latest > /dev/null #2>/dev/null
+
+    echo ""
+    echo guru
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/guru@latest > /dev/null #2>/dev/null
+
+    echo ""
     echo golint
-    "$pkg_dst_cmd" get golang.org/x/lint/golint > /dev/null #2>/dev/null
-    echo errcheck
-    "$pkg_dst_cmd" get github.com/kisielk/errcheck > /dev/null #2>/dev/null
-    echo gotags
-    "$pkg_dst_cmd" get github.com/jstemmer/gotags > /dev/null #2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/lint/golint@latest > /dev/null #2>/dev/null
+
+    echo ""
     echo goimports
-    "$pkg_dst_cmd" get golang.org/x/tools/cmd/goimports > /dev/null #2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/goimports@latest > /dev/null #2>/dev/null
+
+    echo ""
     echo gorename
-    "$pkg_dst_cmd" get golang.org/x/tools/cmd/gorename > /dev/null #2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/gorename@latest > /dev/null #2>/dev/null
+
+    echo ""
     echo gotype
-    "$pkg_dst_cmd" get golang.org/x/tools/cmd/gotype > /dev/null #2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/gotype@latest > /dev/null #2>/dev/null
+
+    echo ""
     echo stringer
-    "$pkg_dst_cmd" get golang.org/x/tools/cmd/stringer > /dev/null #2>/dev/null
-    echo goreturns
-    "$pkg_dst_cmd" get github.com/sqs/goreturns > /dev/null #2>/dev/null
+    "$pkg_dst_cmd" get golang.org/x/tools/cmd/stringer@latest > /dev/null #2>/dev/null
+
+    echo ""
+    echo golangci-lint
+    "$pkg_dst_cmd" get github.com/golangci/golangci-lint/cmd/golangci-lint@latest > /dev/null #2>/dev/null
+
+    echo ""
 }
 
 pkg_done_message() {
index 6d8f73bd29819020940d092d7d07113bd2ddae29..d9235271f7b8c4d585bd636e6ed23eb8a2ae44b9 100644 (file)
@@ -7,7 +7,13 @@
 let g:syntastic_go_checkers = ['go', 'golint', 'errcheck']
 
 " tell vim-go that goimports is installed
-let g:go_fmt_command = "goreturns"
+let g:go_fmt_command = "goimports"
+
+" Show type info as you type
+let g:go_auto_type_info = 1
+
+" golangci-lint on save
+let g:go_metalinter_autosave=1
 
 " tell vim-go to highlight
 let g:go_highlight_functions = 1
@@ -15,3 +21,25 @@ let g:go_highlight_methods = 1
 let g:go_highlight_structs = 1
 let g:go_highlight_operators = 1
 let g:go_highlight_build_constraints = 1
+
+" and lots of extra highligting
+let g:go_highlight_extra_types = 1
+let g:go_highlight_operators = 1
+let g:go_highlight_function_calls = 1
+let g:go_highlight_fields = 1
+let g:go_highlight_build_constraints = 1
+let g:go_highlight_generate_tags = 1
+let g:go_highlight_format_strings = 1
+let g:go_highlight_variable_declarations = 1
+let g:go_highlight_variable_assignments = 1
+
+" and error highlighting
+let g:go_highlight_array_whitespace_error = 1
+let g:go_highlight_chan_whitespace_error = 1
+let g:go_highlight_space_tab_error = 1
+let g:go_highlight_trailing_whitespace_error = 1
+
+" highlighting that doesn't seem to help
+" let g:go_highlight_string_spellcheck = 1
+" let g:go_highlight_function_parameters = 1
+" let g:go_highlight_types = 1
index acd91816db624c76b2ca8b343be34ef0bfc612cc..c5bbe992506ff2bb61327e85e18fe3b00b7d0da4 100644 (file)
 
     # Install go linting tools
     echo "Building go language tools..."
-    echo gopls
-    go get golang.org/x/tools/gopls > /dev/null #2>/dev/null
-    echo golint
-    go get golang.org/x/lint/golint > /dev/null #2>/dev/null
-    echo errcheck
+    export GO111MODULE=on
+
+    echo ""
+
+    # Official Golang Tooling
+    echo -n "golint: "
+    go get golang.org/x/lint/golint@latest > /dev/null #2>/dev/null
+    echo -n "gopls: "
+    go get golang.org/x/tools/gopls@latest > /dev/null #2>/dev/null
+    echo -n "guru: "
+    go get golang.org/x/tools/cmd/guru@latest > /dev/null #2>/dev/null
+    echo -n "goimports: "
+    go get golang.org/x/tools/cmd/goimports@latest > /dev/null #2>/dev/null
+    echo -n "gorename: "
+    go get golang.org/x/tools/cmd/gorename@latest > /dev/null #2>/dev/null
+    echo -n "gotype: "
+    go get golang.org/x/tools/cmd/gotype@latest > /dev/null #2>/dev/null
+
+    echo -n "golangci-lint: "
+    go get github.com/golangci/golangci-lint/cmd/golangci-lint@master > /dev/null #2>/dev/null 
+
+    # Community Tooling
+    echo -n "fillstruct: "
+    go get github.com/davidrjenni/reftools/cmd/fillstruct@master > /dev/null #2>/dev/null
+    echo -n "godef: "
+    go get github.com/rogpeppe/godef@master > /dev/null #2>/dev/null
+    echo -n "motion: "
+    go get github.com/fatih/motion@master > /dev/null #2>/dev/null
+    echo -n "errcheck: "
     go get github.com/kisielk/errcheck > /dev/null #2>/dev/null
-    echo goimports
-    go get golang.org/x/tools/cmd/goimports > /dev/null #2>/dev/null
-    echo goreturns
-    go get github.com/sqs/goreturns > /dev/null #2>/dev/null
+    echo -n "dlv: "
+    go get github.com/go-delve/delve/cmd/dlv@master > /dev/null #2>/dev/null
+    echo -n "iferr: "
+    go get github.com/koron/iferr@master > /dev/null #2>/dev/null
+    echo -n "impl: "
+    go get github.com/josharian/impl@master > /dev/null #2>/dev/null
+    echo -n "keyify: "
+    go get honnef.co/go/tools/cmd/keyify@master > /dev/null #2>/dev/null
+    echo -n "gomodifytags: "
+    go get github.com/fatih/gomodifytags@master > /dev/null #2>/dev/null
+    echo -n "asmfmt: "
+    go get github.com/klauspost/asmfmt/cmd/asmfmt@master > /dev/null #2>/dev/null
+    echo -n "gotags: "
+    go get github.com/jstemmer/gotags > /dev/null #2>/dev/null
 
     if [ -f "$HOME/.vimrc" ]; then
         set +e
         if ! grep 'source.*go.vim' -r ~/.vimrc; then
-            mkdir -p ~/.vim/plugin
+            mkdir -p ~/.vim/plugins
             printf '\n" Golang: reasonable defaults from webinstall.dev/vim-go\n' >> ~/.vimrc
-            printf 'source ~/.vim/plugin/go.vim\n' >> ~/.vimrc
+            printf 'source ~/.vim/plugins/go.vim\n' >> ~/.vimrc
         fi
         set -e
     fi
 
-    if ! [ -f "$HOME/.vim/plugin/go.vim" ]; then
-        mkdir -p ~/.vim/plugin
+    if ! [ -f "$HOME/.vim/plugins/go.vim" ]; then
+        mkdir -p ~/.vim/plugins
         WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
-        curl -fsS -o ~/.vim/plugin/go.vim "$WEBI_HOST/packages/vim-go/go.vim"
+        curl -fsS -o ~/.vim/plugins/go.vim "$WEBI_HOST/packages/vim-go/go.vim"
     fi
+
+    echo 'Running :GoInstallBinaries in vim ...'
+    printf ':GoInstallBinaries\n:q\n' | vim -e
 }