Skip to content
This repository has been archived by the owner on Jun 25, 2022. It is now read-only.

Commit

Permalink
add godoc links
Browse files Browse the repository at this point in the history
markbates committed Apr 3, 2019
1 parent 8b7150f commit 43e5233
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions v2/README.md
Original file line number Diff line number Diff line change
@@ -193,7 +193,7 @@ When I run `packr2` I get errors like:
expected 'IDENT', found '{'
```

A: Packr works by searching your `.go` files for `packr.New` or `packr.NewBox` calls. Because those files aren't "proper" Go files, Packr can't parse them to find the box declarations. To fix this you need to tell Packr to ignore those files when searching for boxes. A couple solutions to this problem are:
A: Packr works by searching your `.go` files for [`github.com/gobuffalo/packr/v2#New`](https://godoc.org/github.com/gobuffalo/packr/v2#New) or [`github.com/gobuffalo/packr/v2#NewBox`](https://godoc.org/github.com/gobuffalo/packr/v2#NewBox) calls. Because those files aren't "proper" Go files, Packr can't parse them to find the box declarations. To fix this you need to tell Packr to ignore those files when searching for boxes. A couple solutions to this problem are:

* Name the files something else. The `.tmpl` extension is the idiomatic way of naming these types of files.
* Rename the folder containing these files to start with an `_`, for example `_templates`. Packr, like Go, will ignore folders starting with the `_` character when searching for boxes.
@@ -202,7 +202,7 @@ A: Packr works by searching your `.go` files for `packr.New` or `packr.NewBox` c

Q: I need to set the path of a box using a variable, but `packr.New("foo", myVar)` doesn't work correctly.

A: Packr attempts to "automagically" set it's resolution directory when using `packr.New`, however, for dynamic paths you need to set it manually:
A: Packr attempts to "automagically" set it's resolution directory when using [`github.com/gobuffalo/packr/v2#New`](https://godoc.org/github.com/gobuffalo/packr/v2#New), however, for dynamic paths you need to set it manually:

```go
box := packr.New("foo", "|")
@@ -213,7 +213,7 @@ box.ResolutionDir = myVar

Q: I want to write code that using the Packr tools, but doesn't actually pack the files into my binary. How can I do that?

A: Using `packr.Folder` gives you back a `*packr.Box` that can be used as normal, but is excluded by the Packr tool when compiling.
A: Using [`github.com/gobuffalo/packr/v2#Folder`](https://godoc.org/github.com/gobuffalo/packr/v2#Folder) gives you back a `*packr.Box` that can be used as normal, but is excluded by the Packr tool when compiling.

### Packr Finds No Boxes

@@ -224,4 +224,4 @@ DEBU[2019-03-18T18:48:52+01:00] *parser.Parser#NewFromRoots found prospects=0
DEBU[2019-03-18T18:48:52+01:00] found 0 boxes
```

A: Packr works by parsing `.go` files to find `packr.New` and `packr.NewBox` declarations. If there aren't any `.go` in the folder that `packr2` is run in it can not find those declarations. To fix this problem run the `packr2` command in the directory containing your `.go` files.
A: Packr works by parsing `.go` files to find [`github.com/gobuffalo/packr/v2#Box`](https://godoc.org/github.com/gobuffalo/packr/v2#Box) and [`github.com/gobuffalo/packr/v2#NewBox`](https://godoc.org/github.com/gobuffalo/packr/v2#NewBox) declarations. If there aren't any `.go` in the folder that `packr2` is run in it can not find those declarations. To fix this problem run the `packr2` command in the directory containing your `.go` files.

0 comments on commit 43e5233

Please sign in to comment.