Skip to content

Commit

Permalink
update to use os.ExpandEnv(...) to parse env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Karn authored and Dean Karn committed Oct 5, 2016
1 parent 761173d commit 81a1928
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
Package statics
===============

![Project status](https://img.shields.io/badge/version-1.7.0-green.svg)
[![Build Status](https://semaphoreci.com/api/v1/projects/1b97afa9-77f3-43ff-ad26-749958500745/601363/badge.svg)](https://semaphoreci.com/joeybloggs/statics)
[![Go Report Card](http://goreportcard.com/badge/go-playground/statics)](http://goreportcard.com/report/go-playground/statics)
[![GoDoc](https://godoc.org/github.com/go-playground/statics/static?status.svg)](https://godoc.org/github.com/go-playground/statics/static)
![License](https://img.shields.io/dub/l/vibe-d.svg)

Package statics embeds static files into your go applications. It provides helper methods and objects to retrieve embeded files and serve via http.

Expand All @@ -16,15 +18,12 @@ It has the following **unique** features:

Installation
------------
Use go get.

go get github.com/go-playground/statics

or to update

```shell
go get -u github.com/go-playground/statics
```

Then import the validator package into your own code.
Then import the statics package into your own code.

import "github.com/go-playground/statics"

Expand Down
11 changes: 2 additions & 9 deletions static/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,8 @@ func New(config *Config, dirFile *DirFile) (*Files, error) {
processFiles(files, dirFile)
} else {

if config.AbsPkgPath[:7] == "$GOPATH" {

gopath := os.Getenv("GOPATH")

if len(gopath) == 0 {
return nil, errors.New("$GOPATH could not be found; you're setup is not correct")
}

config.AbsPkgPath = gopath + config.AbsPkgPath[7:]
if strings.Contains(config.AbsPkgPath, "$") {
config.AbsPkgPath = os.ExpandEnv(config.AbsPkgPath)
}

if !filepath.IsAbs(config.AbsPkgPath) {
Expand Down

0 comments on commit 81a1928

Please sign in to comment.