Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Stripe Mock Installer for Vagrant VM
#!/bin/bash
## ============================
## Stripe Mock Install
## ============================
# @license http://opensource.org/licenses/BSD-3-Clause
# The Go language is used for the Stripe Mock server
# Can't just run > "sudo apt-get install golang"
# The Ubuntu default is go v1.6 which isn't supported, you get an error about sort.Slice e.g:
# src/github.com/stripe/stripe-mock/server/server.go:478: undefined: sort.Slice
# As per https://tecadmin.net/install-go-on-ubuntu/
# the gocode folder is the workspace for doing downloads, compiles, etc..
# You might need to be sudo (root) to run the following
mkdir -p /opt/go
mkdir -p /opt/gocode
# Obviously change the user to whatever you login with, I'm using a Vagrant VM
sudo chown vagrant:vagrant /opt/
sudo chown vagrant:vagrant /opt/gocode
cd /opt/
wget https://dl.google.com/go/go1.16.4.linux-amd64.tar.gz
sudo tar -xvf go1.16.4.linux-amd64.tar.gz
# Unzips to /opt/go with the binary being /opt/go/bin/go
## This only sets it for now, you also need to export these in the bash profile file e.g ~/.bashrc
export GOROOT=/opt/go
export GOPATH=/opt/gocode
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
# Finally we can install stripe-mock as per https://github.com/stripe/stripe-mock
go get -u github.com/stripe/stripe-mock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment