Skip to content

Instantly share code, notes, and snippets.

View jxsl13's full-sized avatar

John Behm jxsl13

  • Germany
  • 04:29 (UTC +02:00)
View GitHub Profile
@jxsl13
jxsl13 / pre-commit-for-go-projects
Created October 23, 2023 20:00 — forked from alexandervantrijffel/pre-commit-for-go-projects
git pre-commit hook script that runs go build, go test, goimports for all packages
#!/bin/bash
# How to use:
# Store this file as .git/hooks/pre-commit and make it executable
# Or, to share the hook with your team, store as .githooks/pre-commit,
# make this file executable and run:
# git config core.hooksPath .githooks
# A pre-commit hook for go projects. In addition to the standard
@jxsl13
jxsl13 / rw.go
Last active March 11, 2022 11:22 — forked from dchapes/rw.go
One to use context with an io.Reader or io.Writer.
// Package ctx provides some tools/integration with context.Context.
package ctx
import (
"context"
"io"
"time"
)
// Reader wraps an io.Reader with one that checks ctx.Done() on each Read call.
@jxsl13
jxsl13 / .gitignore
Last active July 7, 2021 15:54 — forked from awalterschulze/.gitignore
compile git version inside go binary
mybinary
@jxsl13
jxsl13 / delete_git_submodule.md
Created November 14, 2019 16:55 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule