Re: [go-nuts] Re: [Blog] Context should go away for Go 2

2017-08-13 Thread 'Axel Wagner' via golang-nuts
For the general interest: I wrote up my thoughts on this in a lengthy blog post: Why context.Value matters and how to improve it In particular, I sketch a design how context.Value could be made a language-lev

[go-nuts] Re: Go based JSON Escape/Unescape

2017-08-13 Thread Tong Sun
Oh, yeah, true. Thx a lot. BTW, I *found* the rule on what are to be escaped so that I can embed any arbitrary content as a JSON string: *The following characters are reserved in JSON and must be properly escaped to be used in strings:* - Backspace is replaced with \b. - Form feed is re

[go-nuts] Re: Go based JSON Escape/Unescape

2017-08-13 Thread djadala
may be it is by default ? https://play.golang.org/p/e1mTTLt6zH On Monday, August 14, 2017 at 6:35:41 AM UTC+3, Tong Sun wrote: > > Has anyone done Go based JSON Escape/Unescape yet? > > I want to pass any arbitrary content as a JSON string: > > { > "content": "my escaped strings {\n

Re: [go-nuts] How to correctly add license information when using code from the golang project

2017-08-13 Thread Ian Lance Taylor
On Sun, Aug 13, 2017 at 11:45 AM, Alex wrote: >> So would it be enough (if I switch over to also use BSD3 License) to have >> a license file in my project with this content: >> >> >> Copyright (c) 2009 The Go Authors. All rights reserved. >> Copyright (c) 2017 Alexander Gehres. All rights reserved

Re: [go-nuts] Any way to access the raw IANA Timezone data?

2017-08-13 Thread Ian Lance Taylor
On Sun, Aug 13, 2017 at 4:54 PM, wrote: > > I'm looking to generate accurate VTIMEZONE objects according to RFC5545, and > I > need a reasonable way to access the raw information regarding DST shifts. > > I've read through the time package and I see there's a function called > `LoadLocation` in s

Re: [go-nuts] A small question on os.FileInfo

2017-08-13 Thread Ian Lance Taylor
On Sun, Aug 13, 2017 at 5:27 PM, Timothy Raymond wrote: > > I was working with filepath.Walk(), and I noticed something peculiar about > the os.FileInfo interface that the filepath.WalkFunc receives. According to > the definition here: https://golang.org/pkg/os/#FileInfo, the Size() method > retur

[go-nuts] Go based JSON Escape/Unescape

2017-08-13 Thread Tong Sun
Has anyone done Go based JSON Escape/Unescape yet? I want to pass any arbitrary content as a JSON string: { "content": "my escaped strings {\n \"employees\": {\n \"employee\": [\n {\n \"id\": \"1\",..." } In order to pass a JSO

[go-nuts] Any way to access the raw IANA Timezone data?

2017-08-13 Thread mark
Hello, I'm looking to generate accurate VTIMEZONE objects according to RFC5545, and I need a reasonable way to access the raw information regarding DST shifts. I've read through the time package and I see there's a function called `LoadLocation` in src/time/zoneinfo.go, but I don't see any means

[go-nuts] Re: A small question on os.FileInfo

2017-08-13 Thread peterGo
Dave, Slice lengths are a Go rule. off_t and st_size are POSIX rules. Peter On Sunday, August 13, 2017 at 10:07:08 PM UTC-4, Dave Cheney wrote: > > I can't find the reference at the moment, but a while back when this issue > came up regarding slice len, Robert Griesmer opined that signed inte

[go-nuts] Re: A small question on os.FileInfo

2017-08-13 Thread Dave Cheney
I can't find the reference at the moment, but a while back when this issue came up regarding slice len, Robert Griesmer opined that signed integers are preferred when counting things because unsigned counts don't go negative, they go insanely positive on wrap around. The rule of thumb I draw fr

[go-nuts] Re: A small question on os.FileInfo

2017-08-13 Thread peterGo
Timothy, struct stat { /* ... */ off_t st_size;/* total size, in bytes */ /* ... */ }; off_t is a signed integer. File offsets can be negative. Peter On Sunday, August 13, 2017 at 8:27:21 PM UTC-4, Timothy Raymond wrote: > > I was working with filepath.Walk(), and I noticed

[go-nuts] A small question on os.FileInfo

2017-08-13 Thread Timothy Raymond
I was working with filepath.Walk(), and I noticed something peculiar about the os.FileInfo interface that the filepath.WalkFunc receives. According to the definition here: https://golang.org/pkg/os/#FileInfo, the Size() method returns an int64. Shouldn't this be a uint64? Is there a sane instanc

Re: [go-nuts] Built-in log Package

2017-08-13 Thread 'Axel Wagner' via golang-nuts
I'd consider it quite sensible to log an error *and* handle it (e.g. by retrying). In that case, I wouldn't want it to appear with error-severity in my log - it might be an error string, but it's not an error condition. Only after bailing on handling an error should it stand out in an error log. So

Re: [go-nuts] Re: [ANN] chasquid: An SMTP (email) server written in Go

2017-08-13 Thread Alberto Bertogli
On Fri, Mar 03, 2017 at 04:04:43AM -0800, Christian Joergensen wrote: > Have you considered "un-internalizing" some of your packages that could be > useful outside your project? > > The spf and systemd packages looks pretty useful. I've finally "externalized" some of the internal packages: - ht

[go-nuts] Built-in log Package

2017-08-13 Thread dc0d
Many packages use the built-in log package. It could log data with help from it's type. If we could set the output of the logger to something other than *io.Writer*, like: type Output interface { Printf(format string, vset ...interface{}) Flags() (flag int) Prefix() (prefix string)

Re: [go-nuts] How to correctly add license information when using code from the golang project

2017-08-13 Thread Alex
> > So would it be enough (if I switch over to also use BSD3 License) to have > a license file in my project with this content: > Copyright (c) 2009 The Go Authors. All rights reserved. > Copyright (c) 2017 Alexander Gehres. All rights reserved. > Redistribution and use in source and binary

Re: [go-nuts] Suggestions for go 2

2017-08-13 Thread roger peppe
FWIW I'm strongly -1 on having date-related data in binaries. I think that having a deterministic relationship between source and binary for a given compiler version is an extremely useful property. On 12 Aug 2017 22:48, "Ian Lance Taylor" wrote: On Sat, Aug 12, 2017 at 1:52 PM, Robert Solomon

[go-nuts] HTML template from template.FuncMap

2017-08-13 Thread Kai Hendry
Hi there, I'm writing a Web based media viewer and I've hit a snag about how to mark up different media. My current code here: https://github.com/kaihendry/lk/blob/5de96f9fe012e9894deef7b9924f96dd8d9c806c/main.go#L181 is certainly wrong. I am puzzled how to use a template here in light of http