VSCode = Visual Studio Code 에서 사용할 수 있는 확장(Extension) 입니다.
Go 에 대해 풍부한 언어 지원을 위한 확장입니다.
링크 : https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go
Go 가 설치되어 있어야 합니다.
현재 설치된 Go path 는 Go: Current GOPATH 명령어로 확인 가능합니다.
IntelliSense
- Auto Completion of symbols as you type (using
gocode) - Signature Help for functions as you type (using
gogetdocorgodef+godoc) - Quick Info on the symbol as you hover over it (using
gogetdocorgodef+godoc)
Code Navigation
- Go to or Peek Definition of symbols (using
gogetdocorgodef+godoc) - Find References of symbols and Implementations of interfaces (using
guru) - Go to symbol in file or see the file outline (using
go-outline) - Go to symbol in workspace (using
go-symbols) - Toggle between a Go program and the corresponding test file.
Code Editing
- Code Snippets for quick coding
- Format code on file save as well as format manually (using
goreturnsorgoimportsorgofmt) - Symbol Rename (using
gorename. Note: For Undo after rename to work in Windows you need to havedifftool in your path) - Add Imports to current file (using
gopkgs) - Add/Remove Tags on struct fields (using
gomodifytags) - Generate method stubs for interfaces (using
impl) - Fill struct literals with default values (using
fillstruct)
Diagnostics
- Build-on-save to compile code and show build errors. (using
go buildandgo test) - Vet-on-save to run
go vetand show errors as warnings - Lint-on-save to show linting errors as warnings (using
golint,gometalinter,megacheck,golangci-lintorrevive) - Semantic/Syntactic error reporting as you type (using
gotype-live)
Testing
- Run Tests under the cursor, in current file, in current package, in the whole workspace using either commands or codelens
- Run Benchmarks under the cursor using either commands or codelens
- Show code coverage either on demand or after running tests in the package.
- Generate unit tests skeleton (using
gotests)
Debugging
- Debug your code, binaries or tests (using
delve)
Others
- Install/Update all dependent Go tools
- Upload to the Go Playground (using
goplay)
Commands
In addition to integrated editing features, the extension also provides several commands in the Command Palette for working with Go files:
Go: Add Importto add an import from the list of packages in your Go contextGo: Current GOPATHto see your currently configured GOPATHGo: Test at cursorto run a test at the current cursor position in the active documentGo: Test Packageto run all tests in the package containing the active documentGo: Test Fileto run all tests in the current active documentGo: Test Previousto run the previously run test commandGo: Test All Packages in Workspaceto run all tests in the current workspaceGo: Generate Unit Tests For PackageGenerates unit tests for the current packageGo: Generate Unit Tests For FileGenerates unit tests for the current fileGo: Generate Unit Tests For FunctionGenerates unit tests for the selected function in the current fileGo: Install ToolsInstalls/updates all the Go tools that the extension depends onGo: Add TagsAdds configured tags to selected struct fields.Go: Remove TagsRemoves configured tags from selected struct fields.Go: Generate Interface StubsGenerates method stubs for given interfaceGo: Fill StructFills struct literal with default valuesGo: Run on Go PlaygroundUpload the current selection or file to the Go Playground