Skip to content

Instantly share code, notes, and snippets.

View eau-de-la-seine's full-sized avatar

Gokan EKINCI eau-de-la-seine

View GitHub Profile
@eau-de-la-seine
eau-de-la-seine / golang-error-handling-proposal.md
Last active December 6, 2018 16:12
proposal: Go 2: Error handling with try-with-resources

Currently:

func CopyFile(src, dst string) error {
	r, err := os.Open(src)
	if err != nil {
		return fmt.Errorf("copy %s %s: %v", src, dst, err)
	}
	defer r.Close()

	w, err := os.Create(dst)
@eau-de-la-seine
eau-de-la-seine / explanation.md
Created June 16, 2017 09:16 — forked from masak/explanation.md
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <[email protected]>
Date:   Sun Apr 15 16:35:03 2012 +0200

When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.