If you do vscode find in regex mode .* it replace lets you do cool things.
I like to use the vs commands (click cmd + shift + p) Sort Lines Ascending and Delete Duplicate Lines to help.
Find:
| ## This is just commands I find useful that I would like to keep | |
| # Build and start go project | |
| go build . && PORT=80 ./${PWD##*/} | |
| # Open Go coverage in a website | |
| go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out && go tool cover -html=coverage.out | |
| ## Put in ~/.zshrc |
The package ctx was adding to Golang after people had started using requests.
In order to use ctxerr you need context passed with every function that returns and error.
This is a find and replace that adds ctx context.Context to all functions that return an error.
cmd + shift + f.* buttonI hereby claim:
To claim this, I am signing this object:
| package tabletest | |
| import "errors" | |
| //ForceError will return an error if the boolean is true | |
| func ForceError(force bool) error { | |
| if force { | |
| return errors.New("forced error") | |
| } | |
| return nil |
This is list of the git commands I use.
The usual flow of developed is clone or fork a repo, create a branch, change code, create commits at logical stopping points, push those commits, and finally merge the branch (usually done on a website).
Branches let you create a copy all the code from whatever branch you are on. This lets you make changes that can be merged back into the original branch, but doesn't effect the original. They help with conflicting changes by multiple people and code reviews.
| #!/bin/sh | |
| echo-bold(){ | |
| echo -e '\e[1m'$1'\e[0m' | |
| } | |
| echo-black(){ | |
| #You probably shouldn't use this | |
| echo -e '\e[30m'$1'\e[0m' | |
| } | |
| echo-red(){ |