Skip to content

Instantly share code, notes, and snippets.

@kublermdk
Last active November 7, 2022 09:44
Show Gist options
  • Save kublermdk/369d480858103337bcd69e210a65bf45 to your computer and use it in GitHub Desktop.
Save kublermdk/369d480858103337bcd69e210a65bf45 to your computer and use it in GitHub Desktop.
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