Re: [go-nuts] where is an online version of older versions like 1.8 1.6 golang pkg doc ?

2018-01-20 Thread paul . totterman
> > Having an option to link to old docs on golang.org (say > golang.org/pkg/something?tag=1.6.0) will result in people linking to > that option, crawlers storing that option, search engines pointing to > that option, and articles, help information and whatever else online > pinning

[go-nuts] JSON and Embedded Types (Aliases)

2018-01-20 Thread dc0d
Why embedded type aliases get ignored through JSON marshaling? For example, having: type Num = int type Count = int type Max = int type Test int type data struct { Num Count Max Test } The only embedded part that gets marshaled to JSON properly, is Test. -- You received this message

Re: [go-nuts] Doc mentioned it's possible to inspect unexported methods using reflect, but I can't figure out how

2018-01-20 Thread Glen Huang
Thanks for the reply. Hopefully the doc can be changed to avoid confusion. On Sunday, January 21, 2018 at 1:16:04 PM UTC+8, Ian Lance Taylor wrote: > > On Sat, Jan 20, 2018 at 8:43 PM, Glen Huang > wrote: > > > > The doc for the method type in the reflect package > >

Re: [go-nuts] Doc mentioned it's possible to inspect unexported methods using reflect, but I can't figure out how

2018-01-20 Thread Ian Lance Taylor
On Sat, Jan 20, 2018 at 8:43 PM, Glen Huang wrote: > > The doc for the method type in the reflect package > (https://golang.org/pkg/reflect/#Method) seems to suggest that it's possible > to inspect a type's unexported methods: > > // PkgPath is the package path that

Re: [go-nuts] Can go files be nested in package?

2018-01-20 Thread Ian Lance Taylor
On Sat, Jan 20, 2018 at 3:56 PM, Peng Yu wrote: > > The following example shows that go files cannot be nested in a > package. Is it so that the go files in a package must be at the root > level of the package? Yes, the go tool expects that all files in a single package will

[go-nuts] Re: Is it possible to determine total number of bytes read/written for an HTTP request? (including headers)

2018-01-20 Thread dedede85dedede
You can implement your own http.Transport.DialContext. // from https://github.com/codesenberg/bombardier type Conn struct { net.Conn read, written *int64 } func (c *Conn) Read(b []byte) (int, error) { n, err := c.Conn.Read(b) if err == nil { atomic.AddInt64(c.read,

[go-nuts] Graven: Build tool for Go projects.

2018-01-20 Thread Clinton Begin
Hi all, I'm looking for feedback on a build tool I created to fill some gaps I saw in the Golang project build space. While I've used this tool for 9 months or so, you can very much consider it a prototype of sorts, or a concept, and PRs are definitely welcome. This is hopefully the beginning

[go-nuts] Doc mentioned it's possible to inspect unexported methods using reflect, but I can't figure out how

2018-01-20 Thread Glen Huang
Hi, The doc for the method type in the reflect package (https://golang.org/pkg/reflect/#Method) seems to suggest that it's possible to inspect a type's unexported methods: // PkgPath is the package path that qualifies a lower case (unexported) // method name. It is empty for

[go-nuts] Can go files be nested in package?

2018-01-20 Thread Peng Yu
Hi, The following example shows that go files cannot be nested in a package. Is it so that the go files in a package must be at the root level of the package? ==> main.go <== // vim: set noexpandtab tabstop=2: package main import ( "fmt" "./mypackage" ) func main() {

Re: [go-nuts] How to import local go files?

2018-01-20 Thread Jan Mercl
No, the imported package consists of all files in the directory denoted by the import path. On Sat, Jan 20, 2018, 23:48 Peng Yu wrote: > OK. In this example, if there are multiple the files in mypackage > directory. All of them will be loaded. Is there a way to only import

Re: [go-nuts] How to import local go files?

2018-01-20 Thread Peng Yu
OK. In this example, if there are multiple the files in mypackage directory. All of them will be loaded. Is there a way to only import a single go file when there are multiple go files in a package directory? On Sat, Jan 20, 2018 at 4:32 PM, Jan Mercl <0xj...@gmail.com> wrote: > Look for the term

Re: [go-nuts] How to import local go files?

2018-01-20 Thread Jan Mercl
Look for the term "exported" in the language specification. On Sat, Jan 20, 2018, 23:30 Peng Yu wrote: > Why is only Add allowed? Where is this documented? > -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] How to import local go files?

2018-01-20 Thread Peng Yu
Why is only Add allowed? Where is this documented? Thanks. On Sat, Jan 20, 2018 at 2:49 PM, Jan Mercl <0xj...@gmail.com> wrote: > > On Sat, Jan 20, 2018 at 9:29 PM Peng Yu wrote: > > s/add/Add/g > > > -- > > -j -- Regards, Peng -- You received this message because you

Re: [go-nuts] How to import local go files?

2018-01-20 Thread Jan Mercl
On Sat, Jan 20, 2018 at 9:29 PM Peng Yu wrote: s/add/Add/g -- -j -- 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

[go-nuts] How to import local go files?

2018-01-20 Thread Peng Yu
Hi, I would like to import go files local. But I got the following error when I try use `add()`. Does anybody know how to fix the error? Thanks. $ cat.sh mypackage/myfile.go main.go ==> mypackage/myfile.go <== package mypackage import "fmt" type Export struct { } func (c Export) DoMagic() {

[go-nuts] Is there something like peekable in python?

2018-01-20 Thread Peng Yu
Hi, the concept of peekable iterator from python is very convenient. Is there something similar in golang. https://github.com/erikrose/more-itertools/blob/master/more_itertools/more.py#L134 -- Regards, Peng -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Badger Write Performance

2018-01-20 Thread dc0d
In docs for boltdb it is stated that NoSync should be used very carefully because it can leave the database in an inconsistent state. If a full fledged distributed database was the case, a no-sync manner would be acceptable. But for an embedded database, it is not a plus (to be performant in

[go-nuts] Re: Badger Write Performance

2018-01-20 Thread Jordan Krage
Are you using 'SyncWrites=false'? (Or 'NoSync' with boltdb?) It looks like the badger benchmarks from github.com/dgraph-io/badger-bench do not sync. On Thursday, January 18, 2018 at 1:33:02 PM UTC-6, dc0d wrote: > > Badger write performance is a bit worse than boltdb. And badger suggests >