Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-23 Thread Sofiane Cherchalli
Hi Silviu, On Sunday, July 23, 2017 at 2:11:29 AM UTC+2, Silviu Capota Mera wrote: > > Hi Sofiane, > > "Is my design wrong?" > Without a bigger picture of what your final aim is, it's hard for an > external observer to tell you if your design is right or wrong. > I was unable to fully grasp the

[go-nuts] Re: How do you test a server?

2017-07-23 Thread Brian Wolter
As others have noted, you can use `net/http/httptest`. I'm not personally a huge fan of that package, though. As a result, I wrote an HTTP testing tool to run API tests against my servers. Of course, it can be used to test against any HTTP service, but it does happen to be written in Go. Test

[go-nuts] [Ann] web2image to take screenshot of web page

2017-07-23 Thread Tong Sun
Please take a look at https://github.com/suntong/*web2image*#-web2image $ web2image Web to image built on 2017-07-23 Tool to take screenshot from a web page Usage: web2image OPTIONS... URL IMAGE-FILE Options: -h, --help display help information -d, --headless use

[go-nuts] Re: How do you test a server?

2017-07-23 Thread st ov
Thanks for the suggestions, but that framework is for mocking a server right? What if what I want to test is a server and endpoints I developed? On Friday, July 21, 2017 at 1:24:23 AM UTC-7, Simon Ritchie wrote: > > My scaffolding tool generates a web server and some unit and integration >

RE: [go-nuts] Understanding least significant byte operation

2017-07-23 Thread John Souvestre
Hi Jan. Hmmm… Here’s what I see. 0001 0001 0010 0010 0011 0001 0100 0100 0101 0001 … 1100 0100 1101 0001 1110 0010 0001 That looks like the least significant set bit to me. John

[go-nuts] Parsing XML with namespaces in golang

2017-07-23 Thread emartinez1847
Hello, So I'm trying to unmarshal an XML with namespaces in go but i just can't find the right parser to do so. My code: package main import "fmt" import "encoding/xml" type Root struct { MNResultsResults []ls `xml:"xmlns ls, MNResultsResults>ssResultSet>ssResult"` } type ls struct {

Re: [go-nuts] Understanding least significant byte operation

2017-07-23 Thread Bakul Shah
This is a standard trick to find the least significant set bit in a word. Only works for 2's complement numbers! -x == ~x+1 For example: x = 0011b (24), ~x+1 = 1100+1 = 1101. Adding them yields 0001; thus only the least significant set bit remains set. Note that func LSB(x

Re: [go-nuts] Understanding least significant byte operation

2017-07-23 Thread Jan Mercl
On Sun, Jul 23, 2017 at 7:26 PM John Souvestre wrote: > I believe that the result is the least significant bit, not byte. Does not look like that: https://play.golang.org/p/thzUaazLSp -- -j -- You received this message because you are subscribed to the Google Groups

RE: [go-nuts] Understanding least significant byte operation

2017-07-23 Thread John Souvestre
I believe that the result is the least significant bit, not byte. John John Souvestre - New Orleans LA From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of Pablo Rozas Larraondo Sent: 2017 July 23, Sun 07:51 To: golang-nuts Subject: [go-nuts]

Re: [go-nuts] [Go2] Proposal remove function return type brackets

2017-07-23 Thread Rémy Oudompheng
With this proposal, can you tell whether the following function F returns one argument (a function) or two arguments (a function and an error) : func F() func(string) []byte, error { blah } Rémy. 2017-07-23 18:18 GMT+02:00 Gert : > I personally don't think () is

[go-nuts] [Go2] Proposal remove function return type brackets

2017-07-23 Thread Gert
I personally don't think () is necessary for output types and is only confusing with the function attributes Example func Hello(b string) ([]byte, error) { } func Hello(b string) []byte, error { } func Hello(b string) a []byte, b error { } Feel free to counter argument

Re: [go-nuts] Understanding least significant byte operation

2017-07-23 Thread Ayan George
On 07/23/2017 08:50 AM, Pablo Rozas Larraondo wrote: > I have seen Go code using this function to find out the least > significant byte of unsigned integers: > > func LSB(ci uint64) uint64 { return uint64(ci) & -uint64(ci) } > > This function works fine but I wonder why, if call the same AND

Re: [go-nuts] Proposal: Blank types instead of Generics for Go 2

2017-07-23 Thread Jesper Louis Andersen
On Sun, Jul 23, 2017 at 10:17 AM 'meta keule' via golang-nuts < golang-nuts@googlegroups.com> wrote: > > Hi, > > here is a proposal for an alternative to Generics for Go2: > > >From a quick skim: It looks like you are trying to discuss a combination of three things: * universals * type

[go-nuts] Understanding least significant byte operation

2017-07-23 Thread Pablo Rozas Larraondo
I have seen Go code using this function to find out the least significant byte of unsigned integers: func LSB(ci uint64) uint64 { return uint64(ci) & -uint64(ci) } This function works fine but I wonder why, if call the same AND operation, it results in an error: "constant -X overflows uint64"

Re: [go-nuts] Bitwise operators applications

2017-07-23 Thread Jan Mercl
On Sun, Jul 23, 2017 at 5:36 AM Alexey Dvoretskiy wrote: > The question is what are practical applications of bitwise operations in Go and when I should use/learn them? Evolution clearly figured out the advantage of repeating fylogenesis in ontogenesis. Programmers

[go-nuts] Re: Bitwise operators applications

2017-07-23 Thread Stefan Nilsson
There is a whole bunch of interesting and efficient (both in practice and in theory) searching and sorting algorithms that rely on bitwise operations. Only a few weeks ago, I wrote a short text about ints and bitwise operations: https://github.com/yourbasic/int It covers radix sorting,

[go-nuts] Re: Proposal: Blank types instead of Generics for Go 2

2017-07-23 Thread mhhcbon
if we could have a list of use case, written in g1, with an explanation about why it can t be generalized, we could check any proposal that at first it answers them, then enter into more detailed study and proposals ? I m reluctant to provide examples about concurrency, i have some ideas of

[go-nuts] Proposal: Blank types instead of Generics for Go 2

2017-07-23 Thread 'meta keule' via golang-nuts
Hi, here is a proposal for an alternative to Generics for Go2: https://github.com/golang/go/issues/21132 Please discuss! -- 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

[go-nuts] Is there some way to set value for unexported nil ptr field of a struct using reflect?

2017-07-23 Thread feilengcui008
Hi, all: I'm writing a little fuzz tool for struct using reflect package, and came across the following case, but didn't find any way to solve it type TestStruct struct { a *int // unexported nil ptr field, how to modify it? b int // unexported not ptr field, can be

Re: [go-nuts] Math on Huge (2GB) numbers in GoLang

2017-07-23 Thread Bakul Shah
I get about 26 seconds to multiple billion bit (2^10^9-1) numbers with Gambit-Scheme (which has a built-in FFT multiplier written in Scheme by Brad Lucier). On the same hardware your bigfft packet takes about 24s for multiplying two billion digit numbers. GMP is of