Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
cooking up a new thing

sam boyer sdboyer

⌨️
cooking up a new thing
View GitHub Profile
View verselect-info.md

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'.
[[projects]]
branch = "2.x"
digest = "1:ee2887fecb4d923fa90f8dd9cf33e876bf9260fed62f2ca5a5c3f41b4eb07683"
name = "github.com/Masterminds/semver"
packages = ["."]
pruneopts = "NUT"
revision = "24642bd0573145a5ee04f9be773641695289be46"
@sdboyer
sdboyer / mechanism.md
Last active Jul 27, 2018
incompats with shadows
View mechanism.md

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
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 github.com/openshift/origin with 2 pkgs; 93 versions to try
(1) try github.com/openshift/origin@20141003
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"),
pkg("b"),
View lv.go
package main
import (
"fmt"
"io/ioutil"
"os"
"github.com/golang/dep/gps"
)
View other_approach.go
package gps
import (
"context"
"sync/atomic"
)
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 (
"context"
"errors"
"fmt"
"net/url"
"sync"
radix "github.com/armon/go-radix"
@sdboyer
sdboyer / ugly.go
Created Feb 23, 2017
clunky, string typing, and subtle dependencies
View ugly.go
func TestFoo(t *testing.T) {
higherLevelCheck(t, someArgs{something})
higherLevelCheck(t, someArgs{somethingElse})
}
func higherLevelCheck(t *testing.T, someArgs Args) {
r, err := doSomething(someArgs)
t.HelperAt("first err nil check")
assert(t, err, nil)
t.HelperAt("first value match check")
You can’t perform that action at this time.