Skip to content

Commit

Permalink
version bump: v0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Nov 15, 2019
1 parent 34a4f94 commit b779132
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions current.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ func (h Here) Current() (Info, error) {

return h.current, h.curErr
}

func Current() (Info, error) {
return New().Current()
}
5 changes: 5 additions & 0 deletions dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func (h Here) Dir(p string) (Info, error) {
})
}

// Dir attempts to gather info for the requested directory.
func Dir(p string) (Info, error) {
return New().Dir(p)
}

func fromNonGoDir(dir string) (Info, error) {
i := Info{
Dir: dir,
Expand Down
2 changes: 1 addition & 1 deletion here.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ func (h Here) cache(p string, fn func(string) (Info, error)) (Info, error) {
return i, nil
}

var nonGoDirRx = regexp.MustCompile(`cannot find main|go help modules|go: |build .:|no Go files`)
var nonGoDirRx = regexp.MustCompile(`cannot find main|go help modules|go: |build .:|no Go files|can't load package`)
1 change: 1 addition & 0 deletions here_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func Test_nonGoDirRx(t *testing.T) {
"go: ",
"build .:",
"no Go files",
"can't load package",
}

for _, tt := range table {
Expand Down
13 changes: 13 additions & 0 deletions pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,16 @@ func (h Here) Package(p string) (Info, error) {
return i, nil

}

// Package attempts to gather info for the requested package.
//
// From the `go help list` docs:
// The -find flag causes list to identify the named packages but not
// resolve their dependencies: the Imports and Deps lists will be empty.
//
// A workaround for this issue is to use the `Dir` field in the
// returned `Info` value and pass it to the `Dir(string) (Info, error)`
// function to return the complete data.
func Package(p string) (Info, error) {
return New().Package(p)
}
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package here

// Version of here
const Version = "v0.4.0"
const Version = "v0.4.1"

0 comments on commit b779132

Please sign in to comment.