Developing for Snap on Windows - Snap-for-Windows/snap GitHub Wiki

Setup

  1. Using MinGW-w64 as demonstrated in this pull request, run /scripts/build_all.sh

Alternative Manual Setup

  1. Install Go as documented on the official Go installation page
  2. Install git
  3. Install Python 2.7
  4. Decide where you want your Go files to reside (a matter of personal preference) and set your GOPATH environment variable to reflect your choice
    • The path you choose will contain any Go source code, binaries, and packages involved in your development
  5. Edit the Windows Path to include Go's \bin folder (contained within the path chosen above) so Go executables can be run from anywhere in the command prompt
  6. go get github.com/Masterminds/glide
  7. go get -d github.com/Snap-for-Windows/snap
  8. cd %GOPATH%\src\github.com\Snap-for-Windows\snap
  9. glide install
    • Installs specific versions of Snap's dependencies
  10. go install
    • This will build the executable and place it inside Go's \bin folder.
  11. cd \cmd\snapctl
  12. go install

Note: At the time of this writing, BYU's networks currently have issue contacting some of the repositories for Snap's dependencies. If Glide errors out, try passing your connection through a VPN outside of BYU's networks.

Testing

After installing and configuring Go, if you wish to test your Go install's functionality, run the following commands:

  1. go get github.com/golang/example/hello
  2. hello

If you see Hello, Go examples!, your installation is working.

Next Steps

Run Snap as instructed here by running the following command in a PowerShell prompt:

snap -t 0 -l 1

In a new PowerShell prompt, run the following command to load a test plugin:

snapctl plugin load %GOPATH%\src\github.com\Snap-for-Windows\snap\plugin\snap-plugin-collector-psutil.exe

Build and install the test plugins as described.