[go-nuts] go modules introspection

2018-09-07 Thread Jens Hausherr
Hi , is there a way to acces go module information programmatically? Background: I am currently using spf13's cobra. It currently only works with packages inside GOPATH. Is there a clean way to identify if the current working directory is a go module and to get module information from go.mod

Re: [go-nuts] time.Time round/truncate not removing nanosceonds component

2018-05-14 Thread Jens Hausherr
rt; it removes the > monotonic time part. It just happens that the nanoseconds are zero on the > "clock" on play: > > https://play.golang.org/p/Kdq_SDTi664 > > To remove the subsecond part use .Truncate(time.Second) (or the > corresponding Round of course) > &

[go-nuts] time.Time round/truncate not removing nanosceonds component

2018-05-13 Thread Jens Hausherr
Hi, here is something I have been puzzled for a few days now. On my OSX machine rounding/truncating of time.Time values apparently does not remove the nanoseconds component as documented when calling Truncate(0)/Round(0). On play.golang.org it works as expected: https://play.golang.org/p/NXyh

Re: [go-nuts] Regexp documentation error?

2017-08-11 Thread Jens Hausherr
> On Fri, Aug 11, 2017 at 12:43 PM Jens Hausherr > wrote: > > > Is the documentation wrong in this case or am I just missing the case > where nil is returned? > > The docs are correct: https://play.golang.org/p/6fiID64IAt > > > -- > > -j > -- You received th

[go-nuts] Regexp documentation error?

2017-08-11 Thread Jens Hausherr
Hi, I was using some Regexp and noted that all functions are documented to return 'nil' if the RE does not match. I was using FindSubmatchString(s string) ad got an empty string array when the expression did not match a string. Example: https://play.golang.org/p/_kSYXM5e_j Is the documentatio

[go-nuts] Re: Interfaces and sync.Mutex

2017-02-02 Thread Jens Hausherr
Thanks for the insights. Am Donnerstag, 12. Januar 2017 21:02:21 UTC+1 schrieb Dave Cheney: > > If you had this > > type I interface { ... } > type T struct { > sync.Mutex > } > var t T > var i I = t > > This is a mistake because a *copy* of the contents of t is assigned to i. > > Every assig

[go-nuts] Interfaces and sync.Mutex

2017-01-12 Thread Jens Hausherr
Hi, here is some code that puzzles me. I recently had defined an interface in a project and had a struct implementing the interface an including "sync.RWMutex" at the same time. Sample Code (running): https://play.golang.org/p/DExfr3Izao If you execute this code it just runs fine. If I "go vet