Re: [go-nuts] Changing wall clock in unit test

2021-07-30 Thread Kurtis Rader
On Thu, Jul 29, 2021 at 9:13 PM Carl wrote: > Is there a way to write a unit test that simulates a change in the wall > clock for a time.Time value? > Here is an example of how the Elvish shell stubs the time.After() function to verify its builtin "sleep" command behaves correctly without having

Re: [go-nuts] Changing wall clock in unit test

2021-07-30 Thread David Finkel
On Fri, Jul 30, 2021 at 12:13 AM Carl wrote: > Hi, > > Is there a way to write a unit test that simulates a change in the wall > clock for a time.Time value? > I use a combination of two approaches to simulate the passage of time (often both work together): - have functions a `now` argument

[go-nuts] How to implement callback in android with Golnag interface

2021-07-30 Thread Jasir Thachaparamban
Hi All, Can someone provide an example code for implementing communication between Golang and android. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang

Re: [go-nuts] Re: Why do I get multiple times the same data?

2021-07-30 Thread Vadim Berezniker
fub is declared outside the for loop and io.Copy(&fub, &q) will append to the buffer. On Thu, Jul 29, 2021 at 11:41 AM hyogy hyogy wrote: > I am more and more convinced that *io.Copy(&fub, &q)* is the problem > > Il giorno mercoledì 28 luglio 2021 alle 17:11:40 UTC+2 hyogy hyogy ha > scritto: >

Re: [go-nuts] Showing effective replace in go modules

2021-07-30 Thread 'Jay Conrod' via golang-nuts
The go command only applies replace directives from the main module's go.mod file. In this example, replace directives in your module B would be applied, but replace directives in A (or any other dependency) would be ignored. This is important for avoiding conflicts that can't easily be resolved (f

Re: [go-nuts] Re: What are the options to fake SQL database for testing?

2021-07-30 Thread Levieux Michel
Also, though I think it's easy to slip into tests that test the mocks if you don't pay attention, you can have arbitrarily numerous mocks without having bad tests. Unit tests are not designed to reflect your runtime environment at all, they're here to make sure your function (program unit) does wha