# Go lang Support for Visual Studio for Windows and Mac
Hackathon project proof-of-concept for a x plat Go language service. Now abandoned.
Done
Planned Supported platforms:
- Visual Studio 2019 16.1 for Windows
- Visual Studio 2019 8.2.0 Preview for Mac
How it does/will work
- Language service smarts are written in Go, using the token, parser, and types libraries
from the Go standard library to lex, parse, and type check the code.
- Editor features talk to this language service through a thin inteop layer built using a
a combination of PInvoke and a cgo c-shared library with C language bindings for Go.
Historical Context
Screenshots are from an earlier build which was a full, from-scratch language service for
Go in C#. Since then, I have changed strategies to enable reuse of existing Go libraries.
We're starting at square one. The code seen here is a series of hacks meant to set the context.
Editor Features
- Currently using TextMate for colorization and outlining and structure. Ideally we'll move
this to using the Go AST or tokens.
- Error squiggles are directly output by the go/parser and go/types libraries as a result of
parsing and type checking the code.
Getting started
- Install the Go development SDK.
- Install gofmt and gogetdoc.
- Build in Visual Studio 2019 16.1+.
- Copy src/test-fodder to your GOPATH directory.
- Open the file in the experimental VS instance.
Windows
- Install Visual Studio 2019 16.1
- Install Go SDK (expects C:\Go)
- Install MinGW32 GCC C/C++ compiler for Windows (expects C:\MinGW)
- Open Go.Windows.sln, rebuild and start 'Visual Studio Extension'
Mac
- Install VS for Mac 8.2 Preview
- Install Go SDK
- Install XCode/Apple developer tools (needed for gcc).
Debugging
- C# code is best debugged from Visual Studio.
- It's recommended that you debug Go Code by:
- Open the root of the repo in VS Code as a folder view
- Install the Go Extension for VS Code
- Test changes using the debugger in VS Code against the 'testapp.go' file.
- Native Go interop layer can only be debugged via GCC, so it's recommended
that you minimize additions to this layer.
Contributions and discussion are absolutely welcome :)