first pass with linter

This commit is contained in:
Jimmy Zelinskie
2014-05-01 00:30:46 -04:00
parent f0bed27b6d
commit b32eaebcd6
9 changed files with 80 additions and 25 deletions
+4 -2
View File
@@ -12,14 +12,17 @@ import (
"time"
)
// Duration wraps a time.Duration and adds JSON marshalling.
type Duration struct {
time.Duration
}
// MarshalJSON transforms a duration into JSON.
func (d *Duration) MarshalJSON() ([]byte, error) {
return json.Marshal(d.String())
}
// UnmarshalJSON transform JSON into a Duration.
func (d *Duration) UnmarshalJSON(b []byte) error {
var str string
err := json.Unmarshal(b, &str)
@@ -61,8 +64,7 @@ type Config struct {
// Open is a shortcut to open a file, read it, and generate a Config.
// It supports relative and absolute paths.
func Open(path string) (*Config, error) {
expandedPath := os.ExpandEnv(path)
f, err := os.Open(expandedPath)
f, err := os.Open(os.ExpandEnv(path))
if err != nil {
return nil, err
}