GithubHelp home page GithubHelp logo

todo-1's Introduction

todo

todo is a simple package that helps you remember the DO in TODO. Oftentimes developers write a TODO and forget about it. The todo package helps you remember those TODOs by allowing you to set an expiration date with the message. If that expiration date is hit, the program will exit and print the message, along with the location of the TODO.

wercker status

##Usage

Usage of todo is very simple. Here is a complete example:

package main

import "github.com/stretchr/todo"

func main() {
  to.Do("2014-May-21","Write the main function")
}

Enabling

By default, todo is not enabled. This is to prevent accidental termination of the application in a production environment.

When disabled, the function it calls is empty. There is still a bit of overhead in passing the arguments by value, however.

In order to enable the todo package, set TODO_ENABLED=1 as an environment variable. We recommend setting it in .bashrc or .bash_profile or similar so it will always be set.

As a result of this requirement, the tests also depend on this environment variable being set. Use TODO_ENABLED=1 go test to test. Simlarly, to run the benchmarks, use TODO_ENABLED=1 go test -bench=..

Behavior

The Do(by, msg string) function takes a "short form" date (YYYY-Month-DD) as the first argument. Internally, the date is parsed and used for comparisons. If the date fails to parse, the function panics to inform the programmer of the error.

todo-1's People

Contributors

tylerb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.