tinygo-edit

command module
v0.0.0-...-6db7ba8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 10 Imported by: 0

README

tinygo-edit

Add an environment variable for tinygo and open the editor.
Using tinygo-edit, you can easily integrate with gopls.

Description

Vim

tinygo-edit-with-vim

If you are using Vim, you had better read the following.

VSCode

tinygo-edit-with-code

If you are using VSCode, you had better read the following.

Bash/ZSH Shell Completion

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

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

Usage (with TinyGo older than 0.15)

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

  1. Remove go.mod in the current dir
  2. If $TINYGOPATH/go.mod exists, delete it.
  3. Restart tinygo-edit.

If you don't want to remove the go.mod, try the following page

Installation

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.

If GOBIN is empty

The command below should be added to your .bashrc or .zshrc.

export PATH="$GOPATH/bin/:$PATH"
If GOBIN is not empty

The command below should be added to your .bashrc or .zshrc.

export PATH="$GOBIN:$PATH"

Build

go build
Environment
  • go
  • kingpin.v2
  • tinygo 0.15

FAQ

I can't "tinygo build" in a vim opened by tinygo-edit.

You can use the unset GOROOT command, which will allow you to build.

Author

sago35 - sago35@gmail.com

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL