Skip to content

Instantly share code, notes, and snippets.

View rogpeppe's full-sized avatar

Roger Peppe rogpeppe

View GitHub Profile
@rogpeppe
rogpeppe / vgoget.sh
Last active August 4, 2023 07:07
go get binary@version
#!/bin/sh
# This command installs binaries at specified versions
# into $GOBIN, $GOPATH/bin or $HOME/bin.
# It assumes Go 1.11.
if [ $# = 0 ]; then
usage: vgoget cmdpackage[@version]... >&2
exit 2
fi
d=`mktemp -d`
cd "$d"

Some thoughts about the draft Go error inspection design

Some error packages intend for programs to act on a single error (the “Cause”) extracted from the chain of wrapped errors. We feel that a single error is too limited a view into the error chain.

It might not feel that way initially, but I believe that a single error is almost as expressive as iterating down the stack looking for an error that fits some criteria, and considerably easier to reason about.

Go Modules Workshop

The aim of this workshop is to familiarise you with the basics of Go modules. By the end, you should know how to:

  • build a project that uses modules
  • create a project that uses modules
  • keep module dependencies up to date
  • manage module dependencies, exclusions and replacements
  • deal with dependencies that don't use Go modules
syntax = "proto3";
package main;
option go_package = "main";
service Chat {
// NewUser creates a new user account.
// It returns a token that acts as a password for
// the user and the IP address of the user client.
@rogpeppe
rogpeppe / go-fuzz.log
Created September 28, 2020 07:41
go-fuzz log
2020/09/26 09:18:20 pprof on localhost:12345
2020/09/26 09:18:21 crasherQueue 0xc0000ca2a0 len 0; space 0 (data 0; error 0; suppression 0)
2020/09/26 09:18:21 crasherQueue 0xc0000ca2a0 len 1; space 659 (data 34; error 466; suppression 159)
2020/09/26 09:18:21 crasherQueue 0xc0000ca2a0 len 2; space 1306 (data 68; error 926; suppression 312)
2020/09/26 09:18:21 crasherQueue 0xc0000ca2a0 len 4; space 2619 (data 135; error 1856; suppression 628)
2020/09/26 09:18:21 crasherQueue 0xc0000ca2a0 len 8; space 5215 (data 267; error 3702; suppression 1246)
2020/09/26 09:18:21 crasherQueue 0xc0000ca380 len 0; space 0 (data 0; error 0; suppression 0)
2020/09/26 09:18:21 crasherQueue 0xc001774000 len 0; space 0 (data 0; error 0; suppression 0)
2020/09/26 09:18:21 crasherQueue 0xc0000ca460 len 0; space 0 (data 0; error 0; suppression 0)
2020/09/26 09:18:21 crasherQueue 0xc0000ca380 len 1; space 632 (data 19; error 460; suppression 153)
// derived from the doc in https://atproto.com/specs/lexicon
package lexicon
#LexiconDoc: {
lexicon!: 1
id!: string
revision?: number
description?: string
defs!: [string]: #LexUserType |
#LexPrimitive |