Re: [go-nuts] Unmarshalling and tags

2016-06-21 Thread Ain
teisipäev, 21. juuni 2016 9:47.54 UTC+3 kirjutas rog: > > I feel your pain - we quite often have tags with entries for three > formats (JSON, YAML and BSON) - but I'm not sure that collapsing them > is necessarily a good idea, as the named tags indicate that the object > is explicitly intended

[go-nuts] Re: A proposal for generic in go

2016-06-21 Thread andrew . mezoni
>> While later I realized that we still need some parameter check in the callee code to satisfy the interface matching (the generic version of each function in my proposal). A am sorry but your judgements is not correct. Here is a proofs: 1. It is redundant to perform check of the correctness

Re: [go-nuts] python bencoded list equivalent in golang

2016-06-16 Thread Matt Harden
We use the type interface{} for data that can contain any type. So you might use bencode([]interface{}{4456, "Rakesh", 27}). On Thu, Jun 16, 2016 at 9:31 AM wrote: > The server which I am contacting to is written in python and excepts > bencoded list. > > In my existing

Re: [go-nuts] [ANN] Mirror of Go SSA

2016-06-16 Thread as . utf8
Have you tried to *go get golang.org/x/tools/go/ssa *? On Wednesday, June 15, 2016 at 10:54:05 AM UTC-7, JW Bell wrote: > > >>I have to say that I don't see a big benefit to mirroring a github > repo on github itself. > There isn't another way to use the ssa package. > > On Tuesday, June 14,

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-16 Thread gordonbgood
No real surprises with the no bounds checks option (-B), it just eliminated the array bounds checks with the rest of the code the same (version 1.7beta1): 0x00dd 00221 (main.go:37) MOVQDI, CX 0x00e0 00224 (main.go:37) SHRQ$5, DI 0x00e4 00228

Re: [go-nuts] context for user credentials

2016-06-15 Thread daviswahl
That's *really *not what you're supposed to use a context for. If you just want a grab bag for random values (and really, you don't), you can just use a map. A context is for sharing scoped data across APIs, threads, and other boundaries. The documentation says "request scoped" but that term

Re: [go-nuts] caching of cgo compilation

2016-06-15 Thread Ian Lance Taylor
On Wed, Jun 15, 2016 at 2:54 PM, Alex Flint wrote: > Under what conditions does a cgo package get recompiled? I am using > go-sqlite3 and it appears that the C compiler/linker is run every time I > build my project, even though I am not changing any of the C sources. I >

[go-nuts] Re: [ANN] reform, a better ORM, reaches v1, moves to gopkg.in

2016-06-24 Thread Tong Sun
Thanks for open up and sharing you fourth milestone Alexey. I have the following questions: - how to define the relations between multiple tables? - how to deal with the case that a table has a composite primary key instead of just a single-field primary key? The answers are better in the

Fwd: [go-nuts] How to init a global map

2016-06-24 Thread Tong Sun
*(Thanks a lot for all your help Val!)* One last question, which I wasn't able to find myself from https://blog.golang.org/go-maps-in-action Since a map is a pointer, for any function that take map as a parameter, or function like, func (s set) Something(xxx) Does it means the map values can

[go-nuts] Re: [ANN] Gomail v2: sending emails faster

2016-06-24 Thread Bernard LEGAUT
I recently switch from go 1.5.1 to go 1.6, and gomail seems to get in trouble. Anyone with the same issue ? Thanks, On Wednesday, September 2, 2015 at 8:55:26 AM UTC-3, Alexandre Cesaro wrote: > > Hi, > > I just released the second version of Gomail >

[go-nuts] Does pprof enabled in production gives a significant impact in performance?

2016-06-23 Thread Marcos Oliveira
Gophers, We are to deploy a service in production and there's the question if we should keep pprof and its HTTP handlers enabled by default in the service or if we should have a flag that enables them when needed, but that would require a restart of the service. Is a significant performance

[go-nuts] GitHub Squash

2016-06-23 Thread Erik Aigner
Since GitHub now supports squash merging branches, wouldn't it be possible to switch the Review/CL system over to GitHub? I think this would lower the entry barrier considerably for new contributors. Cheers, Erik -- You received this message because you are subscribed to the Google Groups

[go-nuts] Why is Errorf() in the fmt packages and not in the errors package?

2016-06-23 Thread jamalsmith95 . bc
The title. -- 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, visit https://groups.google.com/d/optout.

Re: [go-nuts] Automatic type assertion

2016-06-23 Thread Jose Luis Aracil
I use my own "automatic" type assertion library: https://github.com/jaracil/ei El jueves, 9 de junio de 2016, 22:39:46 (UTC+2), Pablo Rozas-Larraondo escribió: > > Sorry I should have been more clear exposing the problem. What I meant by > "automatic type assertion" was something like: > > If

[go-nuts] Why is Errorf() in the fmt packages and not in the errors package?

2016-06-23 Thread Tamás Gulácsi
Formatting? Tuning the question around: fmt.Errorf = errors.New(fmt.Sprintf) - just a convenience function. GMT is quite heavy, errors is light. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] Re: Shuffle Items in a Slice

2016-06-24 Thread Val
2 implementations here : http://www.programming-idioms.org/idiom/10/shuffle-a-list/1564/go As for the map iteration trick, the runtime doesn't guarantee to randomize anything, although it often tries to, so developers don't rely on some specific order. I've seen (in the past) some map

Re: [go-nuts] Shuffle Items in a Slice

2016-06-24 Thread Martin Geisler
On Fri, Jun 24, 2016 at 1:05 PM, dc0d wrote: > > Hi; > > To shuffle items in a slice I'm doing this: > > var res []Item > > //fill res logic > > shuffle := make(map[int]*Item) > for k, v := range res { > shuffle[k] = > } > res = nil > for _, v := range shuffle { >

Re: [go-nuts] Re: undefined: syscall.LoadLibrary

2016-06-24 Thread Konstantin Khomoutov
On Fri, 24 Jun 2016 03:22:23 -0700 (PDT) Andrew Mezoni wrote: > >> So, how exactly does this method work with Linux shared libraries? > > It does not work on Linux. > On Linux you should use the methods: > > dlclose, dlopen, dlmopen - open and close a shared object >

[go-nuts] Re: can't get Content-Type and Content-Disposition to force browser to display "file->save..." dialog in the web browser

2016-06-24 Thread David Marceau
The core problem was: w.Header().Set("Content-Disposition","attachment;filename=" + strOutputFileOfJournalctl) Should actually be: w.Header().Add("Content-Disposition","attachment;filename=" + strOutputFileOfJournalctl) I preferred to put the above line before the serveFile. That's all. Thanks

Re: [go-nuts] Shuffle Items in a Slice

2016-06-24 Thread dc0d
Thanks Val for explanation & clarification; On Friday, June 24, 2016 at 5:24:30 PM UTC+4:30, Val wrote: > > The playground caches everything, so running multiple times the same > program will just serve the previously generated output. > > Also in the playground everything is frozen at some

Re: [go-nuts] Custom syscall.Sockaddr

2016-06-24 Thread Ian Lance Taylor
On Fri, Jun 24, 2016 at 8:05 AM, wrote: > > I am trying to set up an interface from Go to SocketCAN > (https://www.kernel.org/doc/Documentation/networking/can.txt). This > implements the linux socket interface, however it is a completely separate > socket type from the

Re: [go-nuts] How to be safe in Go?

2016-06-24 Thread Nick Pavlica
On Thursday, June 23, 2016 at 6:44:22 PM UTC-6, Caleb Spare wrote: > > > To see if the the > > race detector would find this potential bug for me, I ran the code with > the > > mutex(s) commented out with the -race flag on and didn't get a warning. > > Did you make some concurrent requests?

[go-nuts] generating interfaces from proto3 (grpc)

2016-06-18 Thread Sankar
Hi I've a proto3 file: == message Any { } message InsertParams { Any Record = 1; } service myService { rpc Insert (InsertParams) returns (InsertResponse); } where I have an "Insert" API which expects a InsertParams struct as the parameter. However, the InsertParams

[go-nuts] Powersets and append() confusion

2016-06-18 Thread Oliver Schmid
Hi. I made a string only version of the powerset function on Rosetta Code and ran into a bug where a slice input to *append()* [one, two, three, four] seems to be replaced by [one, two, three, five]. What. Here's the bug on the Go Playground

Re: [go-nuts] Powersets and append() confusion

2016-06-18 Thread Jakob Borg
2016-06-18 19:16 GMT+02:00 Oliver Schmid : > Hi. I made a string only version of the powerset function on Rosetta Code > and ran into a bug where a slice input to append() [one, two, three, four] > seems to be replaced by [one, two, three, five]. What. Note that append()

[go-nuts] Re: Testing best practice: passing and failing test

2016-06-17 Thread paraiso . marc
By the way, Go 1.7 support subtests : https://tip.golang.org/pkg/testing/#hdr-Subtests_and_Sub_benchmarks Which is one of the nicest additions to Go 1.7 Le jeudi 16 juin 2016 16:04:11 UTC+2, Rayland a écrit : > > Let's say I have some piece of code like this: > > type Foo struct { > } > > func

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread
On Friday, June 17, 2016 at 3:52:27 PM UTC+2, gordo...@gmail.com wrote: > > I don't see the point of the exercise other than it proves that not > putting the result of an operation back into the same register reduces the > latency slightly for your processor (whatever it is?); I suspect that if

[go-nuts] When should I use the connection pool?

2016-06-17 Thread cydside
Hi to all, I'm new here and using golang too. I've read some articles and post on Connection Pooling" but I'm still confused. What I'm looking for is a rule of thumb that make me easy to decide when use connection pool. My scenario isn't so complicated: - a web application that makes CRUD

[go-nuts] Gomobile: Large .so/aar file sizes on Android

2016-06-17 Thread rajiivkanchan
Hi All I am using Go version 1.6.2 and Gomobile (sha +6b7a416 from the tip) and to build an Android library. Our code is mostly networking "encoding/json" "fmt" "log" "math/rand" "net" "sort" "time" -- You received this message because you are subscribed to the Google Groups

[go-nuts] export struct method to C-code as callback (cgo-related)

2016-06-17 Thread andrey
Hello, Could you guys please help me. I can't find how to export method function which belongs to some go-struct to C-code (cgo part) as callback. I know how to export simple function which not belongs to any type and use it as callback for C-function, but is it possibly to export method of

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread gordonbgood
I don't see the point to the exercise as far as optimizing golang is concerned. Your experiment just shows that Your compiler (GCC?) missed an optimization as far as reducing backend latency goes. You may also find that swapping the order of some of the instructions such as the second and the

[go-nuts] Re: importer.Default not able to find packages in $GOPATH

2016-06-17 Thread adonovan via golang-nuts
On Friday, 17 June 2016 15:21:55 UTC-4, Joshua Liebow-Feeser wrote: > > Hi All, > > I'm trying to use the go/* packages to parse and type check Go source > code. I've downloaded github.com/coreos/etcd to test this on, and I'm > currently trying it out in the etcdserver subdirectory. When I run

Re: [go-nuts] encoding/json: any way to receive number literal "10.0" into integer field?

2016-06-17 Thread jonathan
Thanks -- I should have clarified that we've ruled that option out (it was our first approach), since we want to stick to the built in types that won't require explicit exchange with the primitive types. jonathan On Fri, Jun 17, 2016 at 02:56:49PM -0700, Edward Muller wrote: > AFAIK (and someone

Re: [go-nuts] How to init a global map

2016-06-23 Thread Tong Sun
I did tried to change to, func (s *set) Init(slice []string) { but that gave loads of errors that I can't fix, hence the question. On Thu, Jun 23, 2016 at 6:19 PM, Val wrote: > Assigning a value to the receiver will only affect local variable. > Try pointer receiver. > >

Fwd: [go-nuts] How to init a global map

2016-06-23 Thread Tong Sun
Is it possible to fix and make the *validSub.Init*([]string{"aa", "bb", "cc"}) works instead? Coming from the OO world, this is a form that I feel more comfort with. Thx. -- Forwarded message -- From: andrey mirtchovski Date: Thu, Jun 23, 2016 at 6:16

[go-nuts] Re: [?] emulating an opengl shader in cpu bound functions

2016-06-23 Thread blueblank
On Wednesday, June 22, 2016 at 5:06:38 PM UTC-4, blue...@gmail.com wrote: > > > > > > Thanks for all the suggestions especially Egon, that put me ahead of my >

Re: [go-nuts] Why is Errorf() in the fmt packages and not in the errors package?

2016-06-23 Thread Rob Pike
To avoid a dependency cycle. fmt depends on errors, so errors can't call functions in fmt. -rob On Thu, Jun 23, 2016 at 1:15 PM, wrote: > The title. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To

[go-nuts] Re: x/mobile: How to generate a builtin error type binding by gobind command?

2016-06-27 Thread Elias Naur
You can't, at least not yet. The use of the builtin error type is an implementation detail of CL 24100 which is about how errors and exceptions are represented in the generated bindings. The CL does make the path toward exposing error to the native languages easier in the future. - elias On

Re: [go-nuts] TLS

2016-06-27 Thread Konstantin Khomoutov
On Mon, 27 Jun 2016 20:04:52 +0600 Oleg Puchinin wrote: > Thank you, Dave ! > Mybe you have simple sample for my ? > Server and client initialization. Sure, the standard package crypto/tls has tests, and your installation of Go comes with full source code of the Go

Re: [go-nuts] TLS

2016-06-27 Thread Sam Whited
On Mon, Jun 27, 2016 at 9:42 AM, Konstantin Khomoutov wrote: > Sure, the standard package crypto/tls has tests, and your installation > of Go comes with full source code of the Go standard library. Reading the source is not the same as documentation or examples;

Re: [go-nuts] Trying to dynamically find interfaces

2016-06-27 Thread Jan Mercl
On Mon, Jun 27, 2016 at 4:16 PM David Koblas wrote: type BaseAppController struct { *Application IGet IList } The above means that every instance of BaseAppController satisfies both the IGet and IList interfaces

Re: [go-nuts] Re: Trouble querying REST API with net/http (api verified working with curl)

2016-06-27 Thread Kiki Sugiaman
Haha! Happens to the best of us every once in a while. On 28/06/16 02:57, mark mellar wrote: ksug, you were right... I was able to replicate the error using curl by changing the -x parameter from 'GET' to 'Get' . How embarrassing, I'll go sit in the corner and think about what I've done...

Re: [go-nuts] Re: formal verification in Go? someday perhaps?

2016-06-27 Thread Scott Cotton
I don't see why not either. I think what's missing for targeting go is this: A library taking ssa representation and producing formal representations (formulae, transition systems, models of parallelism,...) I guess that may actually be many libraries, as there are many different ways to model.

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-25 Thread mhhcbon
Thanks ! Works for me. I m looking forward to implement text stream processing. Next time maybe ! -- 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] Unused var written in closure

2016-06-25 Thread Val
Hello It seems that this code doesn't compile : func main() { var err error err = f() } *prog.go:8: err declared and not used* but this one does : func main() { var err error g := func() {

[go-nuts] cgo not building on darwin

2016-06-25 Thread Michael Soulier
Experimenting with a little cgo, I did this package main /* #include #include static void _FD_SET(int sysfd, void *set) { FD_SET(sysfd, (fd_set*)set); } */ import ( "C" "unsafe" "syscall" ...etc Unfortunately, I'm getting this on my Mac when I try to build.

Re: [go-nuts] golang poll/epoll/select

2016-06-25 Thread Janne Snabb
On 2016-06-25 22:59, Michael Soulier wrote: > I'm curious as to what I'm doing wrong with select here, and if it's > possible to do this with a goroutine like you describe. You should not be using select in the first place. You are making things complicated for no reason whatsoever. (If I

Re: [go-nuts] small defect in os.exec.LookPath

2016-06-25 Thread mhhcbon
Ahm. Very subtle. Changed it to bin := "" bin, err = exec.LookPath(os.Args[0]) if err == nil { wd = filepath.Dir(bin) } thanks for the feedback! Le dimanche 26 juin 2016 00:00:51 UTC+2, Jan Mercl a écrit : > > On Sat, Jun 25, 2016 at 11:19 PM mhhcbon

Re: [go-nuts] small defect in os.exec.LookPath

2016-06-25 Thread Jan Mercl
On Sat, Jun 25, 2016 at 11:19 PM mhhcbon wrote: > bin, err := exec.LookPath(os.Args[0]) Note that this err variable is shadowing the one declared previously. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] [ANN] go-msi: generate msi package with ease

2016-06-25 Thread mhhcbon
Hi, I have released a project to easily generate MSI package on top of wix. I made it primarily to enhance usability of my Go packages, but it can be used for non go projects too. It can handle multiple directories, multiple files, environments variable, and shortcuts.

Re: [go-nuts] Urlwatch

2016-06-25 Thread Tamás Gulácsi
Start with https://github.com/lox/cachecontrol -- 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, visit

[go-nuts] small defect in os.exec.LookPath

2016-06-25 Thread mhhcbon
Hi, i notice a case where LookPath is not really looking for PATH. I have a bin with some files along it, i need to get its path at runtime to find the other files. I use a func like this, minus the fmt prints func getBinPath() (string, error) { var err error wd := "" if

[go-nuts] Re: database proxy ?

2016-06-27 Thread Caleb Doxsey
For postgres use pgbouncer. For mysql there's youtube's vitess. On Monday, June 27, 2016 at 12:24:32 PM UTC-4, Tieson Molly wrote: > > > Are there any existing packages or libraries that implement a generic > database/sql proxy? > > My goal was to create a small service that connected to the

[go-nuts] File method WriteString frequent calls led to a large system cache

2016-06-27 Thread Tamás Gulácsi
Don't Stat on every log line, but use some other mechanism (mutex, channel) to rotate the logs every day. -- 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] Re: Go application hanging and throwing Proxy error: Request Canceled or I/O timeout

2016-06-28 Thread Dave Cheney
Your application has probably run out of file descriptors. On linux you can get a sense of the number of active file descriptors your program is using by looking in the /proc/$PID/fd directory. Where $PID is the process id of your program. /proc/$PID/limits will tell you the current limits

Re: [go-nuts] Re: Shuffle Items in a Slice

2016-06-28 Thread Kaveh Shahbazian
Thanks for the reference! BTW I love this behaviour! On Tue, Jun 28, 2016, 00:14 Chris Hines wrote: > The history of this behavior is explained in the release notes for Go 1.3: > https://golang.org/doc/go1.3#map > > > On Friday, June 24, 2016 at 8:48:20 AM UTC-4, Val wrote:

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread mpvl
This does not work in cases where someone want to use a Transformer in a streaming context (e.g. to create a Reader or Writer or to include the Transform in a Chain). It may we useful to add something like strings.Replacer in runes as well. Alternatively, I have once implemented a generic

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Michael Wain
Why would I use *T over just T ? Michael > On 28 Jun 2016, at 10:05, Jan Mercl <0xj...@gmail.com> wrote: > > On Tue, Jun 28, 2016 at 11:02 AM Michael Wain > wrote: > > > So a := x.(*T) is the same as a := x.(T) ? > > No, because T and *T are distinct types. > >

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Michael Wain
So a := x.(*T) is the same as a := x.(T) ? Michael > On 27 Jun 2016, at 23:33, Axel Wagner wrote: > > Hm? It's this syntax: > https://golang.org/ref/spec#Type_assertions > using *T as the type. > >> On Mon, Jun 27, 2016 at 11:08 PM,

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Jan Mercl
On Tue, Jun 28, 2016 at 11:13 AM Michael Wain wrote: > Why would I use *T over just T ? Consider this program package main import ( "fmt" ) type T int func main() { var a, b T = 42, 314

[go-nuts] [ANN] moved github organization zalando-techmonkeys - Gin middleware projects

2016-06-28 Thread Sandor Szuecs
Hi! We moved our Gin[1] middleware projects[2,3,4] from zalando-techmonkeys to zalando [5,6,7], so if you use one of them please rename your imports. In gin-oauth2 we have a new feature implemented, Google OAuth2 is now available. [1] https://github.com/gin-gonic/gin [2]

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread Tamás Gulácsi
I've used bufio.Scanner to implement a custom transforming stream reader. -- 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] Re: Shuffle Items in a Slice

2016-06-27 Thread Chris Hines
The history of this behavior is explained in the release notes for Go 1.3: https://golang.org/doc/go1.3#map On Friday, June 24, 2016 at 8:48:20 AM UTC-4, Val wrote: > > 2 implementations here : > http://www.programming-idioms.org/idiom/10/shuffle-a-list/1564/go > > As for the map iteration

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread mhhcbon
> > This does not work in cases where someone want to use a Transformer in a streaming context (e.g. to create a Reader or Writer or to include the Transform in a Chain). This really is what i was looking to implement, somehow, src -> transform -> transform -> sink > I've used bufio.Scanner

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread mpvl
On Tue, Jun 28, 2016 at 12:36 PM, mhhcbon wrote: > > > This does not work in cases where someone want to use a Transformer in > a streaming context (e.g. to create a Reader or Writer or to include the > Transform in a Chain). > > This really is what i was looking to

[go-nuts] Re: database proxy ?

2016-06-27 Thread Tamás Gulácsi
Why do you need such a thing? gopkg.in/rana/ora.v3 (esp. the current master branch) has a simple Pool implementation for reusing connections - but no connection limit. Oracle does have a SessionPool implementation, but haven't used it yet. Otherwise, database/sql/driver is quite limited, you

[go-nuts] Best practice when putting large amounts of functionality behind an interface

2016-06-27 Thread Tyler Compton
Right now, I have a web server with an interface that defines methods for every kind of database read/write operation my application has. Unsurprisingly, it's pretty large for a Go interface at around 30 methods. I originally did this because I wanted to be able to support multiple

Re: [go-nuts]

2016-06-25 Thread Justin Israel
On Sat, Jun 25, 2016 at 11:25 PM Oleg Puchinin wrote: > Hello ! > How to make (and load) GUI form in Go ? > Pick a GUI library: https://github.com/avelino/awesome-go#gui > > Oleg. > > -- > You received this message because you are subscribed to the Google Groups >

Re: [go-nuts] How to be safe in Go?

2016-06-24 Thread Justin Israel
On Sat, 25 Jun 2016, 6:27 AM Nick Pavlica wrote: > > > On Thursday, June 23, 2016 at 6:44:22 PM UTC-6, Caleb Spare wrote: >> >> > To see if the the >> > race detector would find this potential bug for me, I ran the code with >> the >> > mutex(s) commented out with the -race

Re: [go-nuts] Custom syscall.Sockaddr

2016-06-26 Thread Elliot Morrison-Reed
I added the SockaddrCAN type to the golang.org/x/sys/unix package, and it works great. I create an issue with links the patch and some test code. https://github.com/golang/go/issues/16188 On Fri, Jun 24, 2016 at 8:57 PM, Elliot Morrison-Reed wrote: > SocketCAN has been

[go-nuts] golang subnet calculation.

2016-06-26 Thread hellobhaskar
Hello I have a requirement to take a supernet ("10.0.0.0/8") and split it into small subnets say /24 size. is there any library which i can use ? in python netaddr has useful routines which i can use to do the same on a side note any one aware of open source IPAM suite written in golang. --

Re: [go-nuts] Interface{} constrains on specific types

2016-06-24 Thread 'Thomas Bushnell, BSG' via golang-nuts
The trick is to do this: Decl special_interface and then special_interface requires an unexported interface which you implement in the specific (new) types that you can store in the thing. On Fri, Jun 24, 2016 at 3:10 PM 'Mihai B' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I'm

Re: [go-nuts] golang poll/epoll/select

2016-06-24 Thread graham4king
If you have a specific case that isn't covered by blocking in a go-routine, you can always use the syscall's directly, with a very similar API to what you would do in C. For example here's the epoll ones in stdlib: https://golang.org/pkg/syscall/#EpollCreate New syscall wrappers are in the

[go-nuts] Interface{} constrains on specific types

2016-06-24 Thread 'Mihai B' via golang-nuts
I'm developing a json schema generator (json schema from Go ast and the other way around). There is a keyword "oneOf" which requires exactly one schema to be valid in this keyword's value. In Go I translate it by using an empty interface{}. The issue is that when I convert the interface{} to

Re: [go-nuts] Re: Any keyboard players here?

2016-06-26 Thread Daniel Skinner
Finally have a place to setup my keyboard and tgui-harm worked well, nice work. On Sun, Jun 26, 2016 at 3:25 AM wrote: > Hi Daniel, > > I already investigated your piano and snd projects at github, but could > not get them working: too much unknown libraries. Anyhow, it seemed

[go-nuts] Re: formal verification in Go? someday perhaps?

2016-06-26 Thread wsc
I think a better question is: can go tools for formal verification become available? The distinction is that formal verification tools can be applied to hardware, protocols, assembly, software, etc. Why not do that in go? Most such tools are in C or C++, and the low level engines/components

[go-nuts] Append to slice... what happens?

2016-06-26 Thread Peter Kleiweg
This: https://play.golang.org/p/AE670rTMpE I don't know what I expected, but it's weird. Don't mess with slices. -- 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

Re: [go-nuts] Append to slice... what happens?

2016-06-26 Thread Jan Mercl
On Mon, Jun 27, 2016 at 12:26 AM Peter Kleiweg wrote: > I don't know what I expected, but it's weird. Don't mess with slices. Well, working as expected, considering slice backing array is possibly shared wrt the result of append. (Or other slice op, b/c slices _are_ values.)

Re: [go-nuts] Where is .gosymtab in go binaries with cgo?

2016-06-26 Thread Tamás Gulácsi
2016. június 26., vasárnap 21:42:15 UTC+2 időpontban Ian Lance Taylor a következőt írta: > > On Sun, Jun 26, 2016 at 12:18 AM, Tamás Gulácsi > wrote: > > I want to find out the source package's given the binary. > > > > github.com/FiloSottile/gorebuild (and

[go-nuts] Re: Trouble querying REST API with net/http (api verified working with curl)

2016-06-26 Thread mark mellar
For anyone else having similar issues, I found I was able to work around this by using client.Get() rather than client.Do(). Still not sure what the root cause is though... Cheers. On Friday, June 24, 2016 at 7:32:36 AM UTC+1, mark mellar wrote: > > Good tip on using httputil to inspect the

[go-nuts] Is it safe enough to read uint without lock/atomic operation?

2016-06-26 Thread 苏沛
https://github.com/golang/go/blob/master/src/runtime/chan.go#L655 func reflect_chancap(c *hchan) int { if c == nil { return 0 } return int(c.dataqsiz) } -- 苏沛 -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Urlwatch

2016-06-25 Thread Mohammad Nasirifar
Btw I would like to work on it On Sat, Jun 25, 2016 at 5:16 PM, Mohammad Nasirifar wrote: > Btw I would like to work on it! > > On Sat, Jun 25, 2016 at 5:11 PM, Henrik Johansson > wrote: > >> Cache headers, etags etc and dynamic scheduling of

Re: [go-nuts] golang poll/epoll/select

2016-06-25 Thread Michael Soulier
On Friday, June 24, 2016 at 6:59:28 PM UTC-4, Ian Lance Taylor wrote: > > In Go you normally simply start a goroutine that reads from Stdin and > sends the data over a channel. > > Goroutines are cheap. > > Sure, but when you read and get an EOF you return immediately, so the goroutine would

Re: [go-nuts] Urlwatch

2016-06-25 Thread Mohammad Nasirifar
Btw I would like to work on that! On Saturday, June 25, 2016 at 5:11:34 PM UTC+4:30, Henrik Johansson wrote: > > Cache headers, etags etc and dynamic scheduling of re-fetch sounds useful. > Why not start a little library? > > On Sat, Jun 25, 2016, 13:51 Johann Höchtl >

Re: [go-nuts] golang poll/epoll/select

2016-06-25 Thread Michael Soulier
I thought I got select working but now it's returning immediately even without any input to stdin. // loop forever - we expect to be killed with a SIGTERM or SIGINT for { logger.Debug("going into select on stdin") var r_fdset syscall.FdSet for i := 0; i < 16; i++

Re: [go-nuts] Re: Trouble querying REST API with net/http (api verified working with curl)

2016-06-27 Thread Kiki Sugiaman
I know this is a bit late, so perhaps you don't care anymore... Anyway, the server may not understand the "Get" method in this line: |req, err := http.NewRequest("Get", "https://"+host+".here.com:443/rest/json/flows;, nil) | On 27/06/16 08:22, mark mellar wrote: For anyone else having

Re: [go-nuts] Re: Shuffle Items in a Slice

2016-06-27 Thread Martin Geisler
Hi Val On Fri, Jun 24, 2016 at 2:48 PM, Val wrote: > 2 implementations here : > http://www.programming-idioms.org/idiom/10/shuffle-a-list/1564/go > > As for the map iteration trick, the runtime doesn't guarantee to randomize > anything, although it often tries to, so

[go-nuts] Re: Getting a pointer in a type switch gives a *interface {} if case lists several options

2016-06-26 Thread Constantin Konstantinidis
This is (old) documented issue https://github.com/golang/go/issues/460 related to multiple values in one case of the switch. On Sunday, June 26, 2016 at 5:40:55 PM UTC+2, Constantin Konstantinidis wrote: > > A part of the answer is in the specifications as the method set is > inherited from

Re: [go-nuts] Append to slice... what happens?

2016-06-26 Thread Martin Geisler
Hi Henry, On Mon, Jun 27, 2016 at 3:55 AM, Henry wrote: > If you were to change the code a bit as follows > https://play.golang.org/p/VwtWRQBrEe , it will work as you expect. > > I think it is probably safer to instantiate a slice without specifying the > initial

Re: [go-nuts] Shuffle Items in a Slice

2016-06-27 Thread Martin Geisler
On Fri, Jun 24, 2016 at 2:54 PM, Val wrote: > The playground caches everything, so running multiple times the same program > will just serve the previously generated output. Thanks, that's good to know! Makes a lot of sense too. > Also in the playground everything is frozen

[go-nuts] Question - type assertion x.(*T)

2016-06-27 Thread michaelwain1990
Hi, Reading through gaoling spec regarding type assertions, in some code I've see type assertions like: a := x.(*T) i don't see a mention of that syntax in the spec, what is it doing? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] Urlwatch

2016-06-25 Thread Johann Höchtl
Am Donnerstag, 23. Juni 2016 17:04:54 UTC+2 schrieb Shawn Milochik: > > What do you need it to do, specifically? Doing an http.Get on a page and > storing and comparing the bytes or a hash is something you could write in > under a minute. Why not just do that? > Get notified when a change

Re: [go-nuts] Urlwatch

2016-06-25 Thread Henrik Johansson
Cache headers, etags etc and dynamic scheduling of re-fetch sounds useful. Why not start a little library? On Sat, Jun 25, 2016, 13:51 Johann Höchtl wrote: > > > Am Donnerstag, 23. Juni 2016 17:04:54 UTC+2 schrieb Shawn Milochik: >> >> What do you need it to do,

Re: [go-nuts] russian language books about Go

2016-06-26 Thread adonovan via golang-nuts
On Friday, 24 June 2016 03:10:56 UTC-4, Oleg Puchinin wrote: > > Hello ! > Where I can find subject ? > Hi Oleg, our book The Go Programming Language (gopl.io) is now available in Russian, thanks to Williams Press: http://www.williamspublishing.com/Books/978-5-8459-2051-5.html The ozon.ru site

Re: [go-nuts] Append to slice... what happens?

2016-06-26 Thread Henry
If you were to change the code a bit as follows https://play.golang.org/p/VwtWRQBrEe , it will work as you expect. I think it is probably safer to instantiate a slice without specifying the initial capacity. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] golang poll/epoll/select

2016-06-25 Thread Jesse McNelis
On 25 Jun 2016 11:08 p.m., "Michael Soulier" wrote: > > Sure, but when you read and get an EOF you return immediately, so the goroutine would be busy waiting when there's nothing to read, would it not? > You'll only get an EOF if the file descriptor has been closed, if it's

Re: [go-nuts] Re: can't get Content-Type and Content-Disposition to force browser to display "file->save..." dialog in the web browser

2016-06-25 Thread Matt Harden
That's very strange. Why didn't Set work? Was there some already-existing Content-Disposition value in the header that you needed to retain? On Fri, Jun 24, 2016 at 7:57 AM David Marceau wrote: > The core problem was: >

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-25 Thread Matt Harden
Don't use x/text/runes for this. It's overkill. import "strings" ... strings.NewReplacer("\r\n", "\r\n", "\r", "\r\n").Replace(mystring) On Fri, Jun 24, 2016 at 2:00 PM mhhcbon wrote: > I forgot to mention another difficulty i have using replacement. > > As it will

[go-nuts] 'go tool pprof' only shows "Type: CPU" and not a callgraph

2016-06-27 Thread Dave Cheney
What are the exact commands you used? It is easy to misuse proof, here is a slide with some of the gotchas. http://talks.godoc.org/github.com/davecheney/presentations/writing-high-performance-go.slide#11 -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Best practice when putting large amounts of functionality behind an interface

2016-06-27 Thread Chad
What does the interface look like currently? On Monday, June 27, 2016 at 10:54:31 PM UTC+2, Tyler Compton wrote: > > Right now, I have a web server with an interface that defines methods for > every kind of database read/write operation my application has. > Any example ? > Unsurprisingly,

<    1   2   3   4   5   6   7   8   9   10   >