Re: [go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread T L
On Friday, June 12, 2020 at 1:33:32 PM UTC-4, Ian Lance Taylor wrote: > > On Fri, Jun 12, 2020 at 10:08 AM T L > > wrote: > > > > On Friday, June 12, 2020 at 1:02:30 PM UTC-4, Ian Lance Taylor wrote: > >> > >> On Fri, Jun 12, 2020 at 9:56 AM T L wrote: > >> > > >> > Is "uintptr(uintptr(pt

Re: [go-nuts] Re: Why does Go transform os.Args[] with colons in this way (win32/x64)

2020-06-12 Thread Kurtis Rader
On Thu, Jun 11, 2020 at 8:09 PM Russtopia wrote: > Ah, bad form posting before I tried it in a plain CMD.EXE context. > The args are not transformed running from the vanilla command environment. > Guess it's a nasty interaction with MSYS. > TL;lDR: http://www.mingw.org/wiki/Posix_path_conversion

[go-nuts] Re: surprisingly high (persistent) RSS usage after a spike in memory; questions about allocator debugging

2020-06-12 Thread Uli Kunitz
This looks like that your program is allocating a lot of memory once. Note that even if Go has informed the OS with MADV_FREE that memory can be reclaimed, the OS will only reclaim, when there is actual memory pressure. I suggest to read the document of GODEBUG in https://golang.org/pkg/runtime/

[go-nuts] surprisingly high (persistent) RSS usage after a spike in memory; questions about allocator debugging

2020-06-12 Thread thomas.dullien via golang-nuts
Hey everybody, I am looking at a Go process where the total number of bytes managed by Go's heap in the long run is around 20-30 megs, but the RssAnon reported in /proc/self/status is extremely high (800+ megs). I am trying to figure out what is going on, and have a few questions about the prop

Re: [go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread Ian Lance Taylor
On Fri, Jun 12, 2020 at 10:08 AM T L wrote: > > On Friday, June 12, 2020 at 1:02:30 PM UTC-4, Ian Lance Taylor wrote: >> >> On Fri, Jun 12, 2020 at 9:56 AM T L wrote: >> > >> > Is "uintptr(uintptr(ptr))" a typo? Or are there any other multiple chained >> > conversions examples? >> >> That is not

[go-nuts] Re: How to perform time functions in go template?

2020-06-12 Thread Tamás Gulácsi
Either add a TimeAdd function to the template's FuncMap, or use a constant: {{ $timestamp := .StartsAt.Add 600 }} //10m is 600 ns 2020. június 12., péntek 17:43:56 UTC+2 időpontban Deepika a következőt írta: > > *Objective:* To subtract 10 minutes from go's time.Time > obj

Re: [go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread T L
On Friday, June 12, 2020 at 1:02:30 PM UTC-4, Ian Lance Taylor wrote: > > On Fri, Jun 12, 2020 at 9:56 AM T L > > wrote: > > > > Is "uintptr(uintptr(ptr))" a typo? Or are there any other multiple > chained conversions examples? > > That is not a typo. That is the case that worked in 1.14 an

Re: [go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread Ian Lance Taylor
On Fri, Jun 12, 2020 at 9:56 AM T L wrote: > > Is "uintptr(uintptr(ptr))" a typo? Or are there any other multiple chained > conversions examples? That is not a typo. That is the case that worked in 1.14 and does not work in 1.15. Ian > On Friday, June 12, 2020 at 12:47:03 PM UTC-4, Axel Wagn

Re: [go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread T L
Is "uintptr(uintptr(ptr))" a typo? Or are there any other multiple chained conversions examples? On Friday, June 12, 2020 at 12:47:03 PM UTC-4, Axel Wagner wrote: > > AIUI: The safety rules haven't changed. How the compiler interprets them > has. Previously, it interpreted them so as to allow m

Re: [go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread Ian Lance Taylor
On Fri, Jun 12, 2020 at 9:46 AM 'Axel Wagner' via golang-nuts wrote: > > AIUI: The safety rules haven't changed. How the compiler interprets them has. > Previously, it interpreted them so as to allow multiple chained conversions. > Now it doesn't. Yes. Ian > On Fri, Jun 12, 2020 at 2:28 PM T

Re: [go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread 'Axel Wagner' via golang-nuts
AIUI: The safety rules haven't changed. How the compiler interprets them has. Previously, it interpreted them so as to allow multiple chained conversions. Now it doesn't. On Fri, Jun 12, 2020 at 2:28 PM T L wrote: > > Package unsafe's safety rules > a

[go-nuts] How to perform time functions in go template?

2020-06-12 Thread Deepika
*Objective:* To subtract 10 minutes from go's time.Time object(".StartsAt") in html template (In specific the prometheus alertmanager's email template: email_template.tmpl) *Code: *error_timestamp{{ .StartsAt }} *Alertmanager version*: 0.20.0 *Options tried and corresponding errors :* 1. {{ .S

Re: [go-nuts] bytes.NewBuffer(make([]byte, 0, )) allocates 4096 bytes buffer

2020-06-12 Thread Gautam Saha
Probably I was doing something wrong. @Brian your snippet works as I would have expected. On Friday, 12 June 2020 15:43:14 UTC+5:30, Brian Candler wrote: > > However, it does say "The new Buffer takes ownership of buf" - why would > it do that if it were allocating a new buffer and taking a copy

[go-nuts] What does the content about unsafe.Poiner in the compiler section in Go 1.15 release notes?

2020-06-12 Thread T L
Package unsafe's safety rules allow converting an unsafe.Pointer into uintptr when calling certain functions. Previously, in some cases, the compiler allowed multiple chained conversions (for example, syscall.Syscall(…, uintptr(uintptr(ptr)), …)). T

Re: [go-nuts] Re: GO on multi-processor systems

2020-06-12 Thread Kevin Chadwick
>  If simply being connected to the internet is risky enough that > your machine can be compromised Incidentally, as the leakage is bits over time. OpenSSH added this defence. Add protection for private keys at rest in RAM against speculation and memory sidechannel attacks like Spectre, Meltdow

Re: [go-nuts] bytes.NewBuffer(make([]byte, 0, )) allocates 4096 bytes buffer

2020-06-12 Thread Brian Candler
However, it does say "The new Buffer takes ownership of buf" - why would it do that if it were allocating a new buffer and taking a copy of the original? The code has the answer, it's just a single line: https://golang.org/src/bytes/buffer.go?s=14279:14313#L440 func NewBuffer(buf []byte) *Buffe

Re: [go-nuts] Re: GO on multi-processor systems

2020-06-12 Thread Kevin Chadwick
On 2020-06-12 00:47, joe mcguckin wrote: > Yes, of course they have internet connections, but I don't run virtualization > software. It's my understanding that most of these  > bugs have to do with information leaking from one process or VM to another or > with a process trying to escape from it's

Re: [go-nuts] Re: Why does Go transform os.Args[] with colons in this way (win32/x64)

2020-06-12 Thread 'Axel Wagner' via golang-nuts
I'd assume it has nothing to do with Go at all. You should try this with a minimal C program and look at the results. I assume it's something the shell is doing. On Fri, Jun 12, 2020 at 5:09 AM Russtopia wrote: > Ah, bad form posting before I tried it in a plain CMD.EXE context. > The args are n

Re: [go-nuts] Compiler error when using an interface type in a list

2020-06-12 Thread John Sturdy
Thanks --- I understand the difference now... I had expected the compiler to handle it, on the basis of being able to use an implementation of an interface type wherever the interface type is used, but it looks like it's a mixture of static and dynamic typing and this is where they don't quite