[go-nuts] Dynamic type cloning

2016-08-02 Thread Rayland
Let's say I have an object A of some type. Is there a way to create a new object B with the same type as A without knowing the type of A in advance? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivin

[go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Dave Cheney
TL;DR a shallow copy is easy, but it's almost never what you want. https://play.golang.org/p/wpWN3Znop8 Needing to copy an arbitrary value is usually an anti pattern as values can contain references to other values, which contain references to other values, which contain references to other val

Re: [go-nuts] Re: What lead to the versionning debate?

2016-08-02 Thread atd...@gmail.com
That's somewhat the intent in enabling the timestamping of packages especially wrt. library-vendored package. Flattening dependencies will still be needed but it would be simply a matter of switching a package to the latest package release that a package may have vendored. But again, I would no

[go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Rayland
I basically need something like this: var obj = &Person{Name: "John"} // I don't know what type obj will be everytime var newObj interface{} initNewObj(obj) // now newObj is an empty object of type *Person On Tuesday, August 2, 2016 at 10:21:01 AM UTC+3, Dave Cheney wrote: > > TL;DR a shallo

[go-nuts] memory allocations in net-related modules

2016-08-02 Thread Michael Monashev
Hi, golang-nuts. I'm trying to speed up my app, and deleted all of memory allocation from my code. But how to prevent memory allocation here? ROUTINE net.ipToSockaddr in C:/Go/src/net/ipsock_posix.go 516093 516093 (flat, cum) 24.33% of Total .

Re: [go-nuts] Re: What lead to the versionning debate?

2016-08-02 Thread Dave Cheney
> > That's somewhat the intent in enabling the timestamping of packages > especially wrt. library-vendored package. > Flattening dependencies will still be needed but it would be simply a > matter of switching a package to the latest package release that a package > may have vendored. > > To do

[go-nuts] Re: memory allocations in net-related modules

2016-08-02 Thread Dave Cheney
You cannot, the address of sa escapes to the heap because it is returned to the caller. The solution may be to refactor the method to take a *syscall.SockaddrInet4 that was allocated in the caller, but that is not something that can be done as a consumer of the net package. On Tuesday, 2 August

[go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Dave Cheney
Hypothetically, if there was a syntax in Go that did this, what would you do next ? In other words, what is the problem you are trying to solve that has lead you to needing this feature? On Tuesday, 2 August 2016 18:18:05 UTC+10, Rayland wrote: > > I basically need something like this: > > var o

Re: [go-nuts] Re: Dynamic type cloning

2016-08-02 Thread 'Axel Wagner' via golang-nuts
It's simple enough to do with reflection: https://play.golang.org/p/YkDVdu_9ph On Tue, Aug 2, 2016 at 10:18 AM, Rayland wrote: > I basically need something like this: > > var obj = &Person{Name: "John"} // I don't know what type obj will be > everytime > var newObj interface{} > > initNewObj(obj

[go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Rayland
I am working in the context of an ODM. I have an update method, like this: func Update(key string, valuePtr interface{}) error Inside of this method I need to do a Get in order to get the old value, compare the modified fields and update them, then insert the new object in the database. The

Re: [go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Jan Mercl
On Tue, Aug 2, 2016 at 10:58 AM Rayland wrote: > func Update(key string, valuePtr interface{}) error The signature does not look good to me. Is it possible to redesign this function so it does not take an interface{} but a specific interface type which has the methods you need inside Update? int

Re: [go-nuts] Re: What lead to the versionning debate?

2016-08-02 Thread atd...@gmail.com
Indeed, that's where we are coming short. The Go ecosystem does not own its package releasing process. (with a release identification scheme that may different from semver since we do not need to worry about major versions for reasons of different release semantics) A `go release` command that

[go-nuts] Golang git library able to communicate with LFS?

2016-08-02 Thread Johann Höchtl
Hi, Is there a golang library available which is able to access Git LFS https://github.com/git-lfs/lfs-test-server ? https://github.com/libgit2/git2go ? https://github.com/src-d/go-git ? Thank you, Johann -- You received this message because you are subscribed to the Google Groups "golang-nu

Re: [go-nuts] Golang git library able to communicate with LFS?

2016-08-02 Thread Jakob Borg
The repo you linked to includes the official client code. That's probably the best starting point. 2016-08-02 11:42 GMT+02:00 Johann Höchtl : > Hi, > > Is there a golang library available which is able to access Git LFS > https://github.com/git-lfs/lfs-test-server ? > > https://github.com/libgit2/

Re: [go-nuts] Golang git library able to communicate with LFS?

2016-08-02 Thread Johann Höchtl
Am Dienstag, 2. August 2016 11:59:26 UTC+2 schrieb Jakob Borg: > > The repo you linked to includes the official client code. That's > probably the best starting point. > > Which repo do you mean? https://github.com/git-lfs/lfs-test-server is a server library exposing LFS API endpoint, it's not a

Re: [go-nuts] Golang git library able to communicate with LFS?

2016-08-02 Thread Jakob Borg
2016-08-02 12:28 GMT+02:00 Johann Höchtl : > Am Dienstag, 2. August 2016 11:59:26 UTC+2 schrieb Jakob Borg: >> >> The repo you linked to includes the official client code. That's >> probably the best starting point. >> > Which repo do you mean? https://github.com/git-lfs/lfs-test-server is a > serv

[go-nuts] Re: gomobile installation problem

2016-08-02 Thread vejdani . shojae
> Something is interfering with your computer accessing that URL. Probably a > proxy, anti virus, or wifi captive portal. I live in Iran and golang.org is blocked for Iranian users by golang company ... it is our right than can be use freely golang ... that's true? -- You received this mes

[go-nuts] Re: memory allocations in net-related modules

2016-08-02 Thread postmaster
sync.Pool can suppress many of this allocations. -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, vis

[go-nuts] IDE for GOLANG

2016-08-02 Thread kritika . mittal
Hi, is there IDE for creating a web service in GOLANG by using Revel framework which follows MVC architecture. i am using Ubuntu .. -- *Watch our latest TV Commercial #IndiaKiKhoj * -- You received this message because you are subscribed to the Google

[go-nuts] Re: Go 1.7 Release Candidate 4 is released

2016-08-02 Thread ibnesayeed
Hi, Docker image (https://hub.docker.com/_/golang/) is not updated to 1.7rc4 yet. Best, -- Sawood Alam On Monday, August 1, 2016 at 11:03:20 PM UTC-4, Chris Broadfoot wrote: > > Hello gophers, > > We have just released go1.7rc4, a release candidate for Go 1.7. > It is cut from release-branch.

[go-nuts] gomobile - go version required and how to report bugs/questions

2016-08-02 Thread danilolr
Hi, I am making some basic tests with gomobile. It is not working. What are the requirements of go version ? I am using go 1.6 on linux. What are the right place to post issues / bug reports ? There are no issues tab on https://github.com/golang/mobile. What is the right place to pla

[go-nuts] golang non-availability in Iran...

2016-08-02 Thread vejdani . shojae
Hi is golang free to all? why golang.org is block for Iranian users ?? -- 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 golang-nuts+unsubscr...@googlegroups.com. F

[go-nuts] iterating in golang

2016-08-02 Thread kritika . mittal
i want to iterate through the results fetched by executing the query . i have the following code snippet :- iter := session.Query("select * from test_table where ID= ? ", g).Iter() now i want to iterate through the iterator such that if the table structure of test_table is like column_1 |

[go-nuts] importing the structure and methods from other folders

2016-08-02 Thread kritika . mittal
> > hi, > i am tryin to implement MVC architecture in GOLANG. > i am using revel framework . > > i have created two folders model and controller . > now according to MVS ,logic should be in controller and when i am trying > to access the funtion written in model folder in controller , i am get

Re: [go-nuts] Re: gomobile installation problem

2016-08-02 Thread John McKown
On Tue, Aug 2, 2016 at 3:34 AM, wrote: > > Something is interfering with your computer accessing that URL. Probably a >> proxy, anti virus, or wifi captive portal. > > > I live in Iran and golang.org is blocked for Iranian users by golang > company ... it is our right than can be use freely golan

[go-nuts] Where can I read the slide of "The Design of the Go Assembler" on GopherCon2016 ?

2016-08-02 Thread Cholerae Hu
Hi golang-nuts, Recently I'm reading slides of GopherCon2016, but I can't found the slide of "The Design of the Go Assembler". The official repo on github (https://github.com/gophercon/2016-talks/blob/master/RobPike-TheDesignOfTheGoAssembler/README.md) gives me an url(https://talks.golang.org/2

Re: [go-nuts] Where can I read the slide of "The Design of the Go Assembler" on GopherCon2016 ?

2016-08-02 Thread Rob Pike
They will be posted when the video is available. -rob On Tue, Aug 2, 2016 at 10:32 PM, Cholerae Hu wrote: > Hi golang-nuts, > Recently I'm reading slides of GopherCon2016, but I can't found the slide > of "The Design of the Go Assembler". The official repo on github ( > https://github.com/goph

[go-nuts] mgo r2016.08.01 released

2016-08-02 Thread Gustavo Niemeyer
Hello Gophers, A major new release of mgo was just published with relevant enhancements and fixes: http://blog.labix.org/2016/08/01/mgo-r2016-08-01 Please let me know if you find any issues. gustavo @ http://niemeyer.net -- You received this message because you are subscribed to the Google G

[go-nuts] Problem with Net UDP (ipv6) client socket

2016-08-02 Thread CN47
I'm working on an API that should connect via IPv4 and Ipv6 to a server via UDP packets and send/receive information to/from that server. Please see the below example. This seems to work even though I've specified "udp" and not "udp6" (Both server and client address are local to a network) pack

Re: [go-nuts] golang non-availability in Iran...

2016-08-02 Thread Ian Lance Taylor
On Tue, Aug 2, 2016 at 1:37 AM, wrote: > Hi > is golang free to all? > why golang.org is block for Iranian users ?? https://github.com/golang/go/issues/12380 Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

Re: [go-nuts] Re: What lead to the versionning debate?

2016-08-02 Thread atd...@gmail.com
Having an interface between go get and the location of the repositories should really allow people to move packages around at will provided the registration of a package provides a canonical import path. (and a facility for the declaration of mirrors) Now, to accomodate with vcs and demands for

[go-nuts] mysql driver ?

2016-08-02 Thread Victor L
I have to query mysql database in my code...Do i need to add github mackage for mysql driver? import ( _ "github.com/go-sql-driver/mysql" ) Or is it already in "database/sql" and i need to register it? Thanks, -Victor -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] gomobile - go version required and how to report bugs/questions

2016-08-02 Thread Daniel Skinner
> What are the right place to post issues / bug reports ? File issues here, https://github.com/golang/go/issues Prefix the subject with x/mobile: > What is the right place to place questions about the use/developement questions about gomobile. This mailing list would be the right place to start.

Re: [go-nuts] mysql driver ?

2016-08-02 Thread Jan Mercl
On Tue, Aug 2, 2016 at 4:21 PM Victor L wrote: > I have to query mysql database in my code...Do i need to add github mackage for mysql driver? import ( _ "github.com/go-sql-driver/mysql" ) yes -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] golang non-availability in Iran...

2016-08-02 Thread Sam Whited
On Tue, Aug 2, 2016 at 8:43 AM, Ian Lance Taylor wrote: > On Tue, Aug 2, 2016 at 1:37 AM, wrote: >> Hi >> is golang free to all? >> why golang.org is block for Iranian users ?? > > https://github.com/golang/go/issues/12380 This feels poor to say the least; I hate to whip a dead horse, but would

[go-nuts] how to apply netutil.LimitListener() to ListenAndServeTLS()'s listener? how to fetch ListenAndServeTLS()'s listener?

2016-08-02 Thread David Marceau
I found an example to limit the number of connections for a listener: import "golang.org/x/net/netutil"//Within net/netutil/listen.go//func LimitListener(l net.Listener, n int) net.Listener connectionCount := 2 l, err := net.Listen("tcp", ":8000")if err != nil { log.Fatalf("Listen: %v", er

Re: [go-nuts] Re: Dynamic type cloning

2016-08-02 Thread roger peppe
On 2 August 2016 at 09:58, Rayland wrote: > I am working in the context of an ODM. > > I have an update method, like this: > > func Update(key string, valuePtr interface{}) error > > > Inside of this method I need to do a Get in order to get the old value, > compare the modified fields and update

Re: [go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Guianu Leon
Well I will only get the fields that have to be updated, not the entire object. Therefore I need to get the old object from the database, see what has changed, then insert it back. On Aug 2, 2016 18:35, "roger peppe" wrote: > On 2 August 2016 at 09:58, Rayland wrote: > > I am working in the con

[go-nuts] Re: how to apply netutil.LimitListener() to ListenAndServeTLS()'s listener? how to fetch ListenAndServeTLS()'s listener?

2016-08-02 Thread David Marceau
Another question: Why wasn't tlsListener placed as part of the Server structure? I think it makes sense to place it there since it is the server that creates and uses it. It also makes sense to expose it to tweak it as some might more control over it and in this case the constraining the number

Re: [go-nuts] Re: Dynamic type cloning

2016-08-02 Thread roger peppe
On 2 August 2016 at 16:46, Guianu Leon wrote: > Well I will only get the fields that have to be updated, not the entire > object. Therefore I need to get the old object from the database, see what > has changed, then insert it back. If you're seeing only the fields that have to be updated, how wi

[go-nuts] CGO export function parameter types in packages

2016-08-02 Thread Vladimír Magyar
when I create an new type from C type and then use it as a function parameter type, in function that I want to be exported then everything is OK main.go: package main import "C" type MyInt C.int //export f func f(x tests.MyInt) { } and then $ go build -v -buildmode=c-shared -o main.so main.

Re: [go-nuts] golang non-availability in Iran...

2016-08-02 Thread Ian Lance Taylor
On Tue, Aug 2, 2016 at 8:08 AM, Sam Whited wrote: > On Tue, Aug 2, 2016 at 8:43 AM, Ian Lance Taylor wrote: >> On Tue, Aug 2, 2016 at 1:37 AM, wrote: >>> Hi >>> is golang free to all? >>> why golang.org is block for Iranian users ?? >> >> https://github.com/golang/go/issues/12380 > > This feels

Re: [go-nuts] CGO export function parameter types in packages

2016-08-02 Thread Ian Lance Taylor
On Tue, Aug 2, 2016 at 8:05 AM, Vladimír Magyar wrote: > > why is that? the MyInt type is just an alias of C.int. or? I didn't look too closely, but I think this is https://golang.org/issue/13467 . Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Nathan Fisher
It sounds like you could do something similar-ish to the way sorting is handled in the sort package with interfaces. Some immediate concerns that jump out wrt a read and partial update that is done outside the data source: - partial update implies some form of locking (either optimistic, distribut

Re: [go-nuts] Problem with Net UDP (ipv6) client socket

2016-08-02 Thread Jakob Borg
> On 2 aug. 2016, at 15:19, CN47 wrote: > > I'm working on an API that should connect via IPv4 and Ipv6 to a server via > UDP packets and send/receive information to/from that server. > > Please see the below example. This seems to work even though I've specified > "udp" and not "udp6" (Both

[go-nuts] build.golang.org analog

2016-08-02 Thread Michael Monashev
Hi Do you know analog of https://build.golang.org/ for testing/benchmarking golang modules on all possible OS/arch? -- Michael -- 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

[go-nuts] Re: Golang git library able to communicate with LFS?

2016-08-02 Thread Rick Olson
Hi Johann, As Jakob pointed out https://github.com/github/git-lfs/lfs is the closest to a Go library that I know of. Unfortunately, the API is not great and needs to change. I wouldn't depend on it without vendoring to a specific commit. Our focus has been working on a stable command line tool,

[go-nuts] Go 1.7 Release Candidate 5 is released

2016-08-02 Thread Chris Broadfoot
Hello gophers, We have just released go1.7rc5, a release candidate for Go 1.7. It is cut from release-branch.go1.7 at the revision tagged go1.7rc5. rc5 includes three fixes: two to the `go doc` command, and one fix for time for macOS Sierra Beta 4. Please help us by testing your Go programs with

[go-nuts] Re: IDE for GOLANG

2016-08-02 Thread Dat Huynh
I use vimgo https://github.com/fatih/vim-go On Tuesday, August 2, 2016 at 10:25:21 PM UTC+10, kritika...@indiamart.com wrote: > > Hi, > is there IDE for creating a web service in GOLANG by using Revel framework > which follows MVC architecture. > > i am using Ubuntu .. > > > > *Watch our lat

[go-nuts] http.Client returning "http2: no cached connection was available"

2016-08-02 Thread 'Russ Amos' via golang-nuts
I'm seeing "http2: no cached connection was available" failures from http.Client when I start many (~hundreds) requests at once. (This issue was also posted to golang-nuts@ in April , with no response) I may not understand corre

[go-nuts] Re: IDE for GOLANG

2016-08-02 Thread sleepy
In my idea, the best one at present is Visual Studio Code + Go extension 在 2016年8月2日星期二 UTC+8下午8:25:21,kritika...@indiamart.com写道: > > Hi, > is there IDE for creating a web service in GOLANG by u

Re: [go-nuts] http.Client returning "http2: no cached connection was available"

2016-08-02 Thread Brad Fitzpatrick
Sorry, I don't read all of golang-nuts@ and never saw that. You could've escalated, though. There are at least two bug trackers available to you: http://b/ https://github.com/golang/go/issues (the one I prefer) But I think your interpretation of the the HTTP/2 client is wrong. If you're a video

Re: [go-nuts] http.Client returning "http2: no cached connection was available"

2016-08-02 Thread 'Russ Amos' via golang-nuts
Those messages aren't GODEBUG output, it's the errors printed by the program as received from http.Client.Get. I'll file a bug. On Tue, Aug 2, 2016 at 9:51 PM Brad Fitzpatrick wrote: > Sorry, I don't read all of golang-nuts@ and never saw that. You could've > escalated, though. There are at leas

Re: [go-nuts] http.Client returning "http2: no cached connection was available"

2016-08-02 Thread 'Russ Amos' via golang-nuts
http://golang.org/issues/16582 On Tue, Aug 2, 2016 at 10:00 PM Russ Amos wrote: > Those messages aren't GODEBUG output, it's the errors printed by the > program as received from http.Client.Get. I'll file a bug. > > On Tue, Aug 2, 2016 at 9:51 PM Brad Fitzpatrick > wrote: > >> Sorry, I don't re

Re: [go-nuts] http.Client returning "http2: no cached connection was available"

2016-08-02 Thread Brad Fitzpatrick
Oh, sorry, I read that as GODEBUG=http2debug=1. Okay, I'll follow up in https://golang.org/issues/16582 On Tue, Aug 2, 2016 at 7:00 PM, Russ Amos wrote: > Those messages aren't GODEBUG output, it's the errors printed by the > program as received from http.Client.Get. I'll file a bug. > > On Tue

Re: [go-nuts] http.Client returning "http2: no cached connection was available"

2016-08-02 Thread 'Russ Amos' via golang-nuts
Thanks for the extremely quick triage, Brad. I'll work around it in my program, for now. On Tue, Aug 2, 2016 at 10:08 PM Brad Fitzpatrick wrote: > Oh, sorry, I read that as GODEBUG=http2debug=1. > > Okay, I'll follow up in https://golang.org/issues/16582 > > On Tue, Aug 2, 2016 at 7:00 PM, Russ

Re: [go-nuts] Re: IDE for GOLANG

2016-08-02 Thread Asit Dhal
If you are looking for things like auto generated files and forms with drag and drop(Visual Studio for ASP.Net) or Eclipse for django. I don't think those are available for Revel. I use sublime text 3 with some plugins. On 8/3/2016 03:40, sleepy wrote: In my idea, the best one at present is

Re: [go-nuts] http.Client returning "http2: no cached connection was available"

2016-08-02 Thread 'Ingo Oeser' via golang-nuts
Could you document your workaround here? It might be needed by others for the next 6 months because the bug has been classified as Go 1.8 work. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving e

Re: [go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Guianu Leon
I've managed to achieve what I was looking for with: reflect.New(reflect.TypeOf(valuePtr).Elem()).Interface() On Tue, Aug 2, 2016 at 8:55 PM, Nathan Fisher wrote: > It sounds like you could do something similar-ish to the way sorting is > handled in the sort package with interfaces. Some immed

[go-nuts] Get all attributes with zero value using reflection

2016-08-02 Thread Rayland
Hi all, How can I use reflect to detect all fields that have the zero value, on a pointer object? Thank you -- 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 g