Skip to content

Instantly share code, notes, and snippets.

cooking up a new thing

sam boyer sdboyer

cooking up a new thing
View GitHub Profile
sdboyer / uPlot.cue
Last active Jan 27, 2021
experimenting with CUEified ts decls
View uPlot.cue
package uplot
// Note that we use the CUE #-prefixed "definitions" here, which means that CUE
// won't output that thing when doing its own eval/rendering. This may change,
// but for the moment we're assuming that typescript generation will not happen
// through any action taken by the `cue` binary, but rather by way of a custom
// program, where we can access the CUE structures directly.
// To that end, all that's really omitted here is "hints" to a theoretical
// typescript generator that tell it to treat the first group as enums, the

The primary purpose of a version selection algorithm is to create a transitively complete list of packages@versions (henceforth, atoms), such that a compiler or interpreter can take the list of atoms and produce working software.

Version selection algorithms aren't magic. They can only be as good as the information they operate on. And there's lots of different kinds of information we could feed in to such an algorithm.

Historically, the main focus has been on information that is more or less provided by humans - for example, negations/exclusions, like min or max version constraints. Relying on humans to make these statements has all the attendant problems of any system reliant on human input: that input is, at times, wrong both major directions:

  • False positives: Humans omit important information, wittingly or not. As a result, it is possible to select a non-working set of atoms.
  • False negatives: Humans include incorrect information, usually innocently. As a result, there are working sets of at
View Gopkg.lock
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
branch = "2.x"
digest = "1:ee2887fecb4d923fa90f8dd9cf33e876bf9260fed62f2ca5a5c3f41b4eb07683"
name = ""
packages = ["."]
pruneopts = "NUT"
revision = "24642bd0573145a5ee04f9be773641695289be46"
sdboyer /
Last active Jul 27, 2018
incompats with shadows

Note: this is a WIP draft to outline the idea, not polished thoughts - will improve on it as i go

Let's start with a simplifying assumption: everything that's happening is API-level breakages in the v0 range, and that making the API signatures line up is sufficient to guarantee a truly compatible build. This is obviously not true, but it is useful because it means we can establish what ideal behavior looks like, and then seek to emulate it.

Say that we have some module at some version, A@v1.0.0, and another module it depends on, B@v0.1.0. We may reasonably expect that, in any future release, B may change its exported API in a way that is incompatible with the way that A@v1.0.0's consumption of it. This is most likely because Bjorn made a change that fell outside of G1P, but it also may be because A was consuming B in a way that cross-compatibility rules identify as being risky.

At the same time, we must also note that even if B does make a backwards-incompatible change, it does not necessar

sdboyer / goslowtests.bash
Created Oct 30, 2017
Figure out which of your go (sub)tests are slow
View goslowtests.bash
# This will sort go test -v output in ascending order of time to complete the test
$ go test -v | sed -n 's#.*PASS: \([^ ]*\) (\([0-9]*\.[0-9]\{2\}\)s)#\2 \1#p' | sort -g
# Add this to e.g. ~/.bashrc, ~/.zshrc, then you can pipe to it: `go test -v | goslowtests`
function goslowtests {
sed -n 's#.*PASS: \([^ ]*\) (\([0-9]*\.[0-9]\{2\}\)s)#\2 \1#p' | sort -g
View output.txt
[footmp] dep init -v 21:32:09
Getting direct dependencies...
Checked 1 directories for packages.
Found 1 direct dependencies.
Root project is "footmp"
1 transitively valid internal packages
2 external packages imported from 1 projects
(0) ✓ select (root)
(1) ? attempt with 2 pkgs; 93 versions to try
(1) try
View new_test.go
"unify project on disjoint package imports + source switching": {
ds: []depspec{
dsp(mkDepspec("root 0.0.0", "b from baz 1.0.0"),
pkg("root", "a", "b"),
dsp(mkDepspec("a 1.0.0"),
pkg("a", "b/foo"),
dsp(mkDepspec("b 1.0.0"),
View lv.go
package main
import (
View other_approach.go
package gps
import (
func (sm *SourceMgr) ListPackages(ctx context.Context, id ProjectIdentifier, v Version) (PackageTree, error) {
subctx, cancel := context.WithCancel(ctx)
quitchan := make(chan struct{})
View deducers.go
package gps
import (
radix ""