elver

command module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 15 Imported by: 0

README

GitHub GitHub go.mod Go version GitHub tag (latest by date) Go

Run your Go Advent of Code solutions with a single command. Write your solution and Elver will take care of the rest.

Features

  • Automatically downloads and caches the input
  • Runs your latest solution and times it
  • Automatic benchmarking of your solution
  • 0 third party dependencies

How does it work?

Elver uses plugin build mode to generate a .so file to dynamically look up the solutions. Solutions must be in an advent folder in a main package which is required by the plugin build mode. A solution represents a day and a part and is defined as func Day[1..25][A|B]... e.g.:

// /2015/01.go
package main

import "errors"

func Day1A(input string) (interface{}, error) {
    return 42, nil
}

func Day1B(input string) (interface{}, error) {
    return nil, errors.New("Not implemented")
}

Running Elver in the root folder will generate /2015/2015.so and output the following:

$ elver
AOC 2015
Day 1 A (312ns):
42
Day 1 B (956ns):
[ERROR] Not implemented

Quick start

1. Install

$ go get github.com/aod/elver

Set your Advent of Code session token in the environment variable AOC_SESSION. This variable is used to automatically download your inputs and cache them.

Benchmarking

Run Elver with the -b flag to benchmark your latest solution:

$ elver -b
AOC 2015
Day 1 A (N=231919370, 5 ns/op, 0 bytes/op, 0 allocs/op):
42
Day 1 B (N=0, 0 ns/op, 0 bytes/op, 0 allocs/op):
[ERROR] Not implemented

Similar

These type of utility tools for Advent of Code als exist for other programming languages like cargo-aoc (Rust) and aocd (Python). Elver finds inspiration in these awesome projects so be sure to check them out as well.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL