Skip to content

Instantly share code, notes, and snippets.

View zachmu's full-sized avatar

Zach Musgrave zachmu

View GitHub Profile
@zachmu
zachmu / not_found_test.go
Last active June 4, 2024 06:30
Go error handling benchmark
// Copyright 2024 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
package main
import (
"log"
"sort"
)
// Interface type used for vars
type Sortable[T comparable] interface {
Less(member T) bool
package main
import (
"fmt"
"io"
"iter"
"math/big"
"math/rand"
)
package scratch3
import (
"errors"
"testing"
)
//go:noinline
func doWorkWithPanic(b *testing.B, n int) {
defer func() {
package main
import (
"fmt"
"sync/atomic"
"time"
"github.com/sirupsen/logrus"
)
// Copyright 2025 Dolthub, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// generate.go transforms a Go coverage HTML report (produced by `go tool cover -html`)
// into a directory of per-file HTML pages with a shared stylesheet and an index page
// showing a table of all files with their coverage percentages.
//
// Usage: go run generate.go <coverage.html>
//
// Output is written to the current directory:
// index.html — table of all source files with coverage stats
// style.css — shared stylesheet
// files/<path>.html — per-file coverage pages mirroring source paths