From b779132fc090a419aab275d4771d0011b36d72a3 Mon Sep 17 00:00:00 2001 From: Mark Bates Date: Fri, 15 Nov 2019 13:30:01 -0500 Subject: [PATCH] version bump: v0.4.1 --- current.go | 4 ++++ dir.go | 5 +++++ here.go | 2 +- here_test.go | 1 + pkg.go | 13 +++++++++++++ version.go | 2 +- 6 files changed, 25 insertions(+), 2 deletions(-) diff --git a/current.go b/current.go index a95d5c8..927633c 100644 --- a/current.go +++ b/current.go @@ -24,3 +24,7 @@ func (h Here) Current() (Info, error) { return h.current, h.curErr } + +func Current() (Info, error) { + return New().Current() +} diff --git a/dir.go b/dir.go index 632315a..1c00fdd 100644 --- a/dir.go +++ b/dir.go @@ -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, diff --git a/here.go b/here.go index dfe73a3..c8379be 100644 --- a/here.go +++ b/here.go @@ -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`) diff --git a/here_test.go b/here_test.go index 0028699..9c0ff51 100644 --- a/here_test.go +++ b/here_test.go @@ -19,6 +19,7 @@ func Test_nonGoDirRx(t *testing.T) { "go: ", "build .:", "no Go files", + "can't load package", } for _, tt := range table { diff --git a/pkg.go b/pkg.go index 9461b9d..31ce170 100644 --- a/pkg.go +++ b/pkg.go @@ -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) +} diff --git a/version.go b/version.go index 9851181..576ffb7 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package here // Version of here -const Version = "v0.4.0" +const Version = "v0.4.1"