[go-nuts] Showing effective replace in go modules

2021-07-29 Thread Amit Saha
Say, i have a module A (github.com/username/foo/v1) with a replace of a third-party package in its go.mod: replace github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt v3.2.1+incompatible Now, i require module A/v1 package from module A in my module B containing the main package: require

[go-nuts] Unit tests: Simulating a change in the system clock

2021-07-29 Thread Carl
Hi, I have a bug that is only triggered when the underlying system clock has changed. Is there a way to write a unit test to simulate this? Cheers, Carl -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Changing wall clock in unit test

2021-07-29 Thread Carl
Hi, Is there a way to write a unit test that simulates a change in the wall clock for a time.Time value? Cheers, Carl -- 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

Re: [go-nuts] Re: Small number change will affect benchmark results

2021-07-29 Thread Wojciech S. Czarnecki
Dnia 2021-07-28, o godz. 19:42:05 Kurtis Rader napisał(a): > [...] I too am mildly annoyed by [Tapir Liu] questions. As I was a few years ago. But let's do Tapir Liu justice: he posted a good manual online [https://go101.org] and he updates it as his knowledge grows. Also his stubborn picking

Re: [go-nuts] doc comment for io.Closer

2021-07-29 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2021-07-29 at 11:45 -0700, Ian Lance Taylor wrote: > > Should this be "unspecified" rather than "undefined"? > > The general concern here is that if there is something like a file > descriptor involved, and if the Close method doesn't take special > protection to avoid problems with

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

2021-07-29 Thread Robert Engels
I don’t like the “solves the problem of your test running fine in isolation but fails when run in concert with other tests”. If you have that problem you have poorly written tests. > On Jul 29, 2021, at 2:05 PM, Andrew Werner wrote: > >  > Another choice to throw into the mix is >

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

2021-07-29 Thread Andrew Werner
Another choice to throw into the mix is https://github.com/cockroachdb/copyist. It comes with different trade offs but if you buy into its framework, it should be much faster than running the database. On Thu, Jul 29, 2021 at 3:13 AM Brian Candler wrote: > You might also want to look at podman,

Re: [go-nuts] golang-announce rss feed

2021-07-29 Thread 'Sebastien Binet' via golang-nuts
Jul 28, 2021 18:02:06 Ferdy : > Up until this morning I had the golang-announce group as an RSS feed in my > teams channel, to keep us updated on new releases, using this url > https://groups.google.com/forum/feed/golang-announce/msgs/rss_v2_0.xml?num=5 > > But it seems this feature has just

Re: [go-nuts] doc comment for io.Closer

2021-07-29 Thread Ian Lance Taylor
On Thu, Jul 29, 2021 at 4:35 AM 'Dan Kortschak' via golang-nuts wrote: > > I just noticed today that the io.Closer docs say that "The behavior of > Close after the first call is undefined. Specific implementations may > document their own behavior". > > Should this be "unspecified" rather than

[go-nuts] gomobile can't get http.Request.URL.Host on Android?

2021-07-29 Thread Halfman Huang
*I wrote something like this in a gomobile project:* *...* *handler := http.NewServeMux()* *...* *handler.HandleFunc(url, onReq)* *...* *func onReq(w http.ResponseWriter, r *http.Request) {* *fmt.Println(r.URL.String())}* *...* *Then I found when this program run on Android device, the URL

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

2021-07-29 Thread hyogy hyogy
I am more and more convinced that *io.Copy(, )* is the problem Il giorno mercoledì 28 luglio 2021 alle 17:11:40 UTC+2 hyogy hyogy ha scritto: > I have recently added a ROT13 logic to a tool of mine. > This tool connects to a server, from which I run commands on the client. > > Here is the code

Re: [go-nuts] Understanding benchstat's output

2021-07-29 Thread Tarmigan
>From the benchstat help text: benchstat -h usage: benchstat [options] old.txt [new.txt] [more.txt ...] options: -alpha α consider change significant if p < α (default 0.05) Specifically the "p" in your results is reported to be at least 0.100 which is probably because you have a

Re: [go-nuts] Re: Small number change will affect benchmark results

2021-07-29 Thread tapi...@gmail.com
On Thursday, July 29, 2021 at 3:22:35 AM UTC-4 axel.wa...@googlemail.com wrote: > FWIW I did take a look at the output (I ended up curious enough): > https://go.godbolt.org/z/WK8xYd1E3 > > Insert and Insert2 generate pretty different code. In particular, Insert2 > uses makeslicecopy, to fold

[go-nuts] doc comment for io.Closer

2021-07-29 Thread 'Dan Kortschak' via golang-nuts
I just noticed today that the io.Closer docs say that "The behavior of Close after the first call is undefined. Specific implementations may document their own behavior". Should this be "unspecified" rather than "undefined"? Dan -- You received this message because you are subscribed to the

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

2021-07-29 Thread Martin Schnabel
hey, your playground link does not compile! therefor you get a rot13 version of the fixed playground link: uggcf://cynl.tbynat.bet/c/_wwLujQtms- ;) Well who wants to be mean. Just move your buffer declaration into the for loop or reset it: https://play.golang.org/p/hGovCri02lc have fun On

Re: [go-nuts] Re: Small number change will affect benchmark results

2021-07-29 Thread 'Axel Wagner' via golang-nuts
BTW: https://pkg.go.dev/math/rand#Read On Thu, Jul 29, 2021 at 9:21 AM Axel Wagner wrote: > FWIW I did take a look at the output (I ended up curious enough): > https://go.godbolt.org/z/WK8xYd1E3 > > Insert and Insert2 generate pretty different code. In particular, Insert2 > uses makeslicecopy,

Re: [go-nuts] Re: Small number change will affect benchmark results

2021-07-29 Thread 'Axel Wagner' via golang-nuts
FWIW I did take a look at the output (I ended up curious enough): https://go.godbolt.org/z/WK8xYd1E3 Insert and Insert2 generate pretty different code. In particular, Insert2 uses makeslicecopy, to fold the `make` and the `copy(s2, a)` (avoiding having to zero the relevant memory). `Insert` uses

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

2021-07-29 Thread Brian Candler
You might also want to look at podman, which runs containers directly as processes under your own userid with no docker daemon - and buildah, the corresponding tool for creating container images. I use them quite a lot for building and running container images before deploying them to

Re: [go-nuts] Re: Small number change will affect benchmark results

2021-07-29 Thread 'Axel Wagner' via golang-nuts
It would have taken you less time to look at the generated code and/or a CPU profile than it would have to post this - let alone the rest of the discussion. I also believe it likely would take more time to type out the answer to your question, than it would for you to look at the generated code