Add an environment variable for tinygo and open the editor. Using tinygo-edit, you can easily integrate with gopls.
If you are using Vim, you had better read the following.
If you are using VSCode, you had better read the following.
By default, all flags and commands/subcommands generate completions internally.
You can enable autocompletion by setting the following to ~/.bashrc
etc.
$ eval "$(tinygo-edit --completion-script-bash)"
Or for ZSH
$ eval "$(tinygo-edit --completion-script-zsh)"
usage: tinygo-edit [<flags>]
Flags:
-h, --help Show context-sensitive help (also try --help-long and
--help-man).
--editor="vim" editor path
--wait wait for the editor to close
--without-goroot don't use proper GOROOT
--target=TARGET target name
--version Show application version.
Now you can use tinygo-edit. It works with or without go.mod, so you can work with gopls very simply.
# Vim
$ tinygo-edit --target xiao --editor vim --wait
# gVim
$ tinygo-edit --target xiao --editor gvim
# VSCode
$ tinygo-edit --target xiao --editor code
deprecated : To be removed in 0.3.0
If you want to use TinyGo older than 0.15, you can disable it with the following
$ tinygo-edit --without-goroot --target xiao --editor code
If it doesn't work, please try the following
If you don't want to remove the go.mod, try the following page
To install, run:
go install github.com/sago35/tinygo-edit@latest
Be sure that you have added your GOBIN to the PATH.
You can find your GOBIN by running go env
.
The command below should be added to your .bashrc
or .zshrc
.
export PATH="$GOPATH/bin/:$PATH"
The command below should be added to your .bashrc
or .zshrc
.
export PATH="$GOBIN:$PATH"
go build
You can use the unset GOROOT
command, which will allow you to build.
sago35 - [email protected]