[go-nuts] Re: How to manage replace directives in go.mod files when code versioning ?

2021-04-26 Thread christoph...@gmail.com
Thank you for pointing this out. I wasn’t aware of it. But the question still holds for published main programs. Le mardi 27 avril 2021 à 07:27:58 UTC+2, Uli Kunitz a écrit : > Are you aware of "replace directives only apply in the main > module's go.mod file and are ignored in other modules.

Re: [go-nuts] rationale for math.Max(1, math.NaN()) => math.NaN()?

2021-04-26 Thread Brian Candler
On Tuesday, 27 April 2021 at 07:28:39 UTC+1 christoph...@gmail.com wrote: > It seam that C is wrong on this one and Go is right. The rationale is that > a NaN must propagate through operations so that we can detect problems > (avoid silent NaNs). See https://en.wikipedia.org/wiki/NaN > > Thus an

Re: [go-nuts] rationale for math.Max(1, math.NaN()) => math.NaN()?

2021-04-26 Thread Bakul Shah
>From the wikipedia article: There are differences of opinion about the proper definition for the result of a numeric function that receives a quiet NaN as input. One view is that the NaN should propagate to the output of the function in all cases to p

Re: [go-nuts] rationale for math.Max(1, math.NaN()) => math.NaN()?

2021-04-26 Thread 'Dan Kortschak' via golang-nuts
On Mon, 2021-04-26 at 23:28 -0700, christoph...@gmail.com wrote: > It seam that C is wrong on this one and Go is right. The rationale is > that a NaN must propagate through operations so that we can detect > problems (avoid silent NaNs). See https://en.wikipedia.org/wiki/NaN > > Thus any operation

Re: [go-nuts] rationale for math.Max(1, math.NaN()) => math.NaN()?

2021-04-26 Thread christoph...@gmail.com
It seam that C is wrong on this one and Go is right. The rationale is that a NaN must propagate through operations so that we can detect problems (avoid silent NaNs). See https://en.wikipedia.org/wiki/NaN Thus any operation involving a NaN must return an NaN and this includes Max and Min. Le

[go-nuts] Re: How to manage replace directives in go.mod files when code versioning ?

2021-04-26 Thread Uli Kunitz
Are you aware of "replace directives only apply in the main module's go.mod file and are ignored in other modules. See Minimal version selection for details."? You can find it here: https://golang.org/ref/mod#go-mod-file-replace On Tuesday

[go-nuts] How to manage replace directives in go.mod files when code versioning ?

2021-04-26 Thread christoph...@gmail.com
When debugging or testing we may need to add a replace directive in the go.mod file. This change intended to be local only may interfere with code versioning. The replace directive may be accidentally committed and published. What is the proper way to manage replace directives when it comes to

Re: [go-nuts] How to do vdso calls in my own code?

2021-04-26 Thread Pure White
Thanks for your reply! In my situation, we are doing trace frequently, and we need to call `time.Now` in each trace span. `time.Now` sometimes cost 1%-2% cpu in flame graph, so I think it’s valuable to do this optimization. Though this optimization is better-to-have for us, I think maybe there’

Re: [go-nuts] How to do vdso calls in my own code?

2021-04-26 Thread Ian Lance Taylor
On Mon, Apr 26, 2021 at 8:57 PM Pure White wrote: > > As you have said, the cost of making the cgo call is too expensive for my > situation. > > I know using go:linkname to call systemstack is magic and neither recommended > nor supported. But I don’t have other choice. > > My application will c

Re: [go-nuts] How to do vdso calls in my own code?

2021-04-26 Thread Pure White
Hi Ian, As you have said, the cost of making the cgo call is too expensive for my situation. I know using go:linkname to call systemstack is magic and neither recommended nor supported. But I don’t have other choice. My application will call `time.Now` very often to get the timestamp, so this

Re: [go-nuts] context package: why need run goroutine in propagateCancel function

2021-04-26 Thread qinggeer Bao
Thanks. I see. 在2021年4月27日星期二 UTC+8 上午5:50:09 写道: > On Mon, Apr 26, 2021 at 9:59 AM qinggeer Bao wrote: > > > > if parentCancelCtx return false, it means no cancellable ancestors > found, then why do we need run another goroutine to listen for parent's > cancel signals? How it can happen in wh

Re: [go-nuts] How to do vdso calls in my own code?

2021-04-26 Thread Ian Lance Taylor
On Mon, Apr 26, 2021 at 1:24 AM Pure White wrote: > > I'm trying to get time using `CLOCK_REALTIME_COARSE` and > `CLOCK_MONOTONIC_COARSE` for performance reasons, and need to use vdso call > by hand-written assembly code. That is, I want to reimplement `time.Now` > using `CLOCK_REALTIME_COARSE`

Re: [go-nuts] context package: why need run goroutine in propagateCancel function

2021-04-26 Thread Ian Lance Taylor
On Mon, Apr 26, 2021 at 9:59 AM qinggeer Bao wrote: > > if parentCancelCtx return false, it means no cancellable ancestors found, > then why do we need run another goroutine to listen for parent's cancel > signals? How it can happen in what kind of cases? See the documentation of parentCancelCt

[go-nuts] Re: Setting the Don't Fragment (DF) bit on OSX

2021-04-26 Thread Alex Besogonov
DF bit is needed to discover the MTU on the application level, exactly because MTU discovery can be broken on lower levels of the network stack. QUIC specifies this procedure here: https://tools.ietf.org/html/draft-ietf-quic-transport-05#page-53 On Saturday, April 24, 2021 at 1:37:26 PM UTC-7 i

[go-nuts] context package: why need run goroutine in propagateCancel function

2021-04-26 Thread qinggeer Bao
For learning purpose, I'm reading the source code of Golang standard package: context. Roughly understand the logics with one confusing point in the propagateCancel below: func propagateCancel(parent Context, child canceler) { done := parent.Done() if done == nil { return // pare

[go-nuts] Re: Run mathematical expression from string

2021-04-26 Thread Pramod Devireddy
https://github.com/Pramod-Devireddy/go-exprtk package does evaluate any kind of mathematical expressions dynamically during run-time. On Tuesday, November 22, 2011 at 3:10:51 PM UTC+5:30 ⚛ wrote: > On Nov 22, 9:26 am, Jan Mercl wrote: > > On Tuesday, November 22, 2011 8:56:25 AM UTC+1, ⚛ wrote:

[go-nuts] [ANN] gomajor - Tool for major version upgrades

2021-04-26 Thread Ilia Choly
Hello, https://github.com/icholy/gomajor This is a tool that tries to alleviate some of the toil that comes with SIV. I've been working on it on and off for a while and am looking for testers/feedback. Thanks, - icholy -- You received this message because you are subscribed to the Google Gro

[go-nuts] How to write new data to http.ResponseWriter

2021-04-26 Thread Van Fury
Hi, I would like to implement an HTTP request and response system of this flow below client --> A --> B > (request) HTTPserver client <-- A <-- B < (response) HTTPserver 1. client send HTTP request with any HTTP method (POST,PUT, etc) to A 2. A

[go-nuts] How to do vdso calls in my own code?

2021-04-26 Thread Pure White
Hi all, I'm trying to get time using `CLOCK_REALTIME_COARSE` and `CLOCK_MONOTONIC_COARSE` for performance reasons, and need to use vdso call by hand-written assembly code. That is, I want to reimplement `time.Now` using `CLOCK_REALTIME_COARSE` and `CLOCK_MONOTONIC_COARSE`. I referenced the cod