英文:
Is there an interpreter and auto-complete tool for golang like ptpython?
问题
对于Golang,你想通过在shell中练习Golang代码来学习,是否有类似于ptpython
的解释器和自动补全工具?
英文:
I'm new to Golang, I want to learn by practicing Golang codes in my shell, is there an interpreter and auto-complete tool like ptpython
for golang?
答案1
得分: 1
如果你正在使用vim:
请查看以下内容:
vim-go文档
答案2
得分: 1
Go语言没有解释器(它是一种编译语言)或REPL,但有一个用于尝试代码的Go Playground(https://play.golang.org/)。
至于自动补全,根据你使用的编辑器,有各种各样的工具可供选择;我使用的是emacs:
M-x package install go-autocomplete:
(ac-config-default)
(require 'auto-complete-config)
(require 'go-autocomplete)
如果你想要一个同时具有REPL和自动补全功能的工具,我可以向你推荐一个用于Go Playground的扩展(如果你使用的是Chrome):
Better Go Playground
它提供以下功能:
- Golang语法高亮显示
- 使用Ace编辑器替代内置编辑器
- 运行代码时标记具有语法错误的行
- 自动补全+代码片段
- 自动保存到本地存储
- 暗色/亮色主题切换
这些功能都在一个类似REPL的环境中(但不能进行网络相关的操作)。
英文:
There isn't an interpreter (it's a compiled language) or REPL for Go, but there is the go playground https://play.golang.org/ for trying out code.
And for autocomplete, there is a variety of tools out there depending on your editor; I use emacs:
> M-x package install go-autocomplete:
(ac-config-default)
(require 'auto-complete-config)
(require 'go-autocomplete)
If you want a REPL and/with autocomplete, the best I can point you towards is an extension for the go play ground (if you using chrome):
Better Go Playground
It advertises:
> - Golang syntax highlighting
> - Replaces the built in with the Ace editor
> - Mark lines with syntax errors when running your code
> - Auto-completion + Snippets
> - Auto-save to local storage
> - Dark/Light theme toggle
all in a REPL like environment (you can't do networking stuff though)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论