Skip to content

Instantly share code, notes, and snippets.

View gonzaloserrano's full-sized avatar
☁️
🧑‍💻

Gonzalo Serrano gonzaloserrano

☁️
🧑‍💻
View GitHub Profile
@gonzaloserrano
gonzaloserrano / goplsu.sh
Created May 17, 2020 10:00
gopls update
#! /bin/bash
set -e
gopls version
TMP_DIR="$(mktemp -d)"
cd "$TMP_DIR"
git clone git@github.com:golang/tools.git
cd tools/gopls
go install .
@gonzaloserrano
gonzaloserrano / opendiff.vim
Last active May 13, 2020 10:55
opendiff from vim map - xcode xcode-select macos
# if you got some complain from xcode run this:
# sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# this is the map that goes to your vimrc
map <c-y> :!git difftool -y --tool=opendiff %<cr>
@gonzaloserrano
gonzaloserrano / graphql.sh
Last active August 13, 2023 23:32
Execute graphQL query or mutation with cURL escaping JSON characters using jq
# usage from another script:
# source /path/to/graphql.sh
# graphql http://localhost:8080/graphql "$SOME_QUERY_OR_MUTATION"
# where $SOME_QUERY_OR_MUTATION is the raw query or mutation, with quotes, new lines etc.
require() {
command -v "$1" >/dev/null 2>&1 || { echo >&2 "$1 program is required"; exit 1; }
}
graphql() {
@gonzaloserrano
gonzaloserrano / PULL_REQUEST_TEMPLATE.md
Created December 2, 2019 15:01
Golang GitHub Pull Request Template

Pull Request Template

Checklist

  • Branch has been rebased with master
  • Commits
    • Have been properly set-up
    • Merge strategy has been specified in the corresponding section
  • Reviewers have been set
  • New or changing code is properly tested
@gonzaloserrano
gonzaloserrano / goplsu.sh
Created November 29, 2019 15:14
update gopls from master
#! /bin/bash
set -e
gopls version
TMP_DIR="$(mktemp -d)"
cd "$TMP_DIR"
git clone git@github.com:golang/tools.git
cd tools/gopls
go install .
@gonzaloserrano
gonzaloserrano / gist:a29187d9baac9c629ec332269476b878
Last active November 11, 2019 16:00
command vs event, sync vs async
Hey,
So I've been thinking about the source of data for the delivery system which is
the creation of the delivery. I've read a bit and talk to some people and
wanted to share some info.
First, the difference between a command and an event is their intent. Both are
DTOs (just transfer data) but:
- an event is something that happened in the past in the producer of the event,
@gonzaloserrano
gonzaloserrano / gorenamez.sh
Created September 27, 2019 10:33
Gorename the ez "easy" way
#! /bin/bash
# makes gorename work with relative pkg paths
command -v gorename >/dev/null 2>&1 || { echo >&2 "I require gorename to run. Install with go get golang.org/x/tools/cmd/gorename. Aborting."; exit 1; }
if [ $# -ne 2 ]; then
echo >&2 "I require two args: origin symbol and destination symbol. Aborting."
exit 1
fi
@gonzaloserrano
gonzaloserrano / go.sh
Created September 5, 2019 18:13
macos brew downgrade to golang 1.12
# download latest 1.12.X on homebrew
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/57c458840f9015ceec58c9793bd50151c1aedf86/Formula/go.rb
@gonzaloserrano
gonzaloserrano / gist:0be9ccd391dbe3c72490b9e312487439
Created September 19, 2018 06:52
go packages without example files
~/gosrc/src master ⇣
❯ for i in `go list ./... | grep -v internal | sed 's#_/Users/gonzalo/gosrc/src/##'`; do if ! [[ -f $i/example_test.go ]]; then echo $i; fi; done
builtin
cmd/addr2line
cmd/api
cmd/asm
cmd/buildid
cmd/cgo
cmd/compile
cmd/cover
HTTP Status 500 - com.google.common.util.concurrent.UncheckedExecutionException: com.netflix.hystrix.exception.HystrixRuntimeException: TenantContextCommand short-circuited and fallback failed.
type Exception report
message com.google.common.util.concurrent.UncheckedExecutionException: com.netflix.hystrix.exception.HystrixRuntimeException: TenantContextCommand short-circuited and fallback failed.
description The server encountered an internal error that prevented it from fulfilling this request.
exception