[go-nuts] iota with gaps

2017-05-02 Thread Jérôme LAFORGE
const ( _ = iota One Two Three _ _ _ Seven Eight Nine ) -- 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

[go-nuts] iota with gaps

2017-05-02 Thread Tong Sun
Hi, How to use `iota` to define consts that have gap(s) in them? E.g., If my consts are, 1, 2, 3, 7, 8, 9 How to use iota to define them? Thx. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Ecdsa different behaviour on 32-bit and 64-bit system

2017-05-02 Thread Todd Neal
Ivan, I tracked down the problem to a difference between the generic and optimized versions of the P256 implementations. I'm not 100% sure of the correct fix, so I submitted it as golang.org/issues/20215 with a link to your example. - Todd On Tuesday, May 2, 2017 at 12:33:56 PM UTC-5, Ivan

[go-nuts] Fully-qualified import paths and Pull Requests

2017-05-02 Thread st ov
How should import paths be handled with regard to pull requests? For example, I fork a project and add an internal package. Convention says I should use the fully-qualified import path in my own project. When creating a pull request this import path would need to be updated to point to the

[go-nuts] Re: Build problem in Liteide

2017-05-02 Thread mahuaduttakundu
Is this possible to add FileDebug similarly ? On Wednesday, February 17, 2016 at 9:27:17 PM UTC+5:30, Jose Maria Galeano wrote: > > It was easy forme I add a ne commnad in View -> Options -> LiteBuild > ...edit gosrc.xml > and add this line > args="build $(EDITOR_FILE_NAME)" save="editor"

[go-nuts] Re: encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Frits van Bommel
On Tuesday, May 2, 2017 at 10:53:36 PM UTC+2, Brian Stengaard wrote: > > > On Tuesday, 2 May 2017 16:02:47 UTC-4, Pierre Curto wrote: >> >> Hello, >> >> My guess: >> If you dont pass in a pointer, then you pass a value. >> What would be the point of updating the value that you will never see and

[go-nuts] Re: encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Brian Stengaard
On Tuesday, 2 May 2017 16:02:47 UTC-4, Pierre Curto wrote: > > Hello, > > My guess: > If you dont pass in a pointer, then you pass a value. > What would be the point of updating the value that you will never see and > that will get discarded? > Hence it returns a map that provides the

[go-nuts] Re: Sorting an array of time.Duration

2017-05-02 Thread ramachandrang
Thank you JuciÊ Andrade & Roberto. On Tuesday, May 2, 2017 at 12:07:19 PM UTC-7, JuciÊ Andrade wrote: > > From Go v1.8 onwards there is yet another alternative: you can use the > sort package without implementing the Sort interface. > > Example: > > https://play.golang.org/p/YmiWpshLlX > --

[go-nuts] Re: encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread pierre . curto
Hello, My guess: If you dont pass in a pointer, then you pass a value. What would be the point of updating the value that you will never see and that will get discarded? Hence it returns a map that provides the unmarshaled values so at least you have something to work with. Le mardi 2 mai 2017

Re: [go-nuts] Is there a way to fee a memory object on demand?

2017-05-02 Thread Jan Mercl
On Tue, May 2, 2017 at 8:35 PM Piotr Narewski wrote: > Does anyone know a way to do something like this (freeing memory on demand), but using pure Go? > Something that will compile (and work) on any platform, without any extra dependencies.. sync.Pool could be probably a

[go-nuts] Re: Sorting an array of time.Duration

2017-05-02 Thread ojucie
>From Go v1.8 onwards there is yet another alternative: you can use the sort package without implementing the Sort interface. Example: https://play.golang.org/p/YmiWpshLlX -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

[go-nuts] encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Brian Stengaard
Hey Gophers, When unmarshalling JSON into a struct with a blank interface (interface{}) I get a surprising result: If I set the field to a pointer to a T value before unmarshalling, the data is filled out on the T value as expected. (See I2 in the playground example.) If I set the field to a

[go-nuts] Re: Sorting an array of time.Duration

2017-05-02 Thread Roberto Zanotto
Seems to me that you didn't understand how to use sort, it's a bit different from what you are used to in other languages. Take a look at the examples in the package docs https://golang.org/pkg/sort/#example_ On Tuesday, May 2, 2017 at 8:16:20 PM UTC+2, ramach...@qualtrics.com wrote: > > Hello,

[go-nuts] Is there a way to fee a memory object on demand?

2017-05-02 Thread Piotr Narewski
My app uses large amounts of memory; it actively allocates and frees lots of slices. I'm talking about gigabytes here. With the default GOGC=100 setting, it needs twice more memory. When I decrease GOGC to a lower value, it affects performance pretty badly. So far the best solution I have

[go-nuts] Sorting an array of time.Duration

2017-05-02 Thread ramachandrang
Hello, I have an array of time.Duration. I want to be able to sort this to do tp90, tp99 calculations. The sort.Sort() library function doesn't work on time.Duration. The error I get is *time.Duration does not implement sort.Interface (missing Len method)* Anyone know if I can add the Len()

[go-nuts] ...interface{} vs interface{} + reflection

2017-05-02 Thread Jonathan Hall
I have a public API that takes `...interface{}` as an argument. (For reference: https://godoc.org/github.com/flimzy/kivik#DB.BulkDocs ) I'm considering changing this to instead take `interface{}` as an argument, then using reflection to: - Validate that the underlying type is an array -

[go-nuts] go/cmd erroneous compile error: initialization loop

2017-05-02 Thread max . dergosits
This gives me a compilation error: https://play.golang.org/p/5nSLXw9n82 but this does not: https://play.golang.org/p/maaTNOVeqM I expected to see no error, and have a valid go program, since there are no real initialization dependencies. This is the output I got: >

[go-nuts] Ecdsa different behaviour on 32-bit and 64-bit system

2017-05-02 Thread ivoras
Hi, I'm using ECDSA with the P256 curve and I've found a problem which I've tracked to a different result of signature verification on the Raspberry Pi and x64 (both Linux and Windows). Later I've verified that i386 behaves as RPI. I've tracked the problem down to this self-contained case:

[go-nuts] Plugin Golang for SonarQube

2017-05-02 Thread Falque Thibault
Hi all, I have created the Golang Sonarqube Plugin . For the moment, 34 rules from GoLint are activated in the profile and provides tests and test coverage metrics. Any feedback or contribution much appreciated! Thanks in advance, Thibault. --

Re: [go-nuts] Re: "Selling" Go to Management

2017-05-02 Thread andrey mirtchovski
On Tue, May 2, 2017 at 10:39 AM, wrote: > - Hey, boss, I want to show a novelty. It's called AUTOMOBILE. > - Go ahead. > - It can carry you to any place you want. > - My horse can carry me to any place I want as well. So what? > - No, I mean, an automobile is much more

[go-nuts] Re: "Selling" Go to Management

2017-05-02 Thread ojucie
- Hey, boss, I want to show a novelty. It's called AUTOMOBILE. - Go ahead. - It can carry you to any place you want. - My horse can carry me to any place I want as well. So what? - No, I mean, an automobile is much more confortable. - Have you ride my horse? - No, I didn't. - So you are not

Re: [go-nuts] Strange Go runtime behavior related to xml.Unmarshal

2017-05-02 Thread Ian Lance Taylor
On Tue, May 2, 2017 at 2:43 AM, Nikos Anastopoulos wrote: > > Thanks for your feedback. As a last question, what is the application > aspect (or other factors) that determines how quickly new threads are being > employed over time? For example, in my scenario above, if I

[go-nuts] Re: Testing reflect.type for equality with another type

2017-05-02 Thread mhhcbon
yes, you can use Name / PgkPath methods to test equality. https://golang.org/pkg/reflect/#Type Those methods might be useful too, // Implements reports whether the type implements the interface type u. Implements(u Type ) bool

Re: [go-nuts] Re: Will deleting a key from a map in an iteration prevent some keys being iterated in the same iteration?

2017-05-02 Thread 'Keith Randall' via golang-nuts
Yes, all keys present in the map at the start of iteration, that aren't deleted during iteration, will be returned during iteration. On Monday, May 1, 2017 at 4:51:56 AM UTC-4, T L wrote: > > > > On Monday, May 1, 2017 at 3:56:51 PM UTC+8, Paul Jolly wrote: >> >> I think the part of the spec

Re: [go-nuts] GC problem

2017-05-02 Thread Jesper Louis Andersen
I don't think it is a GC bug, but rather a trade-off of several desirable properties. The system does the following: - allocates 2gb - Since the current heap size is 0 the 10% gc limit is reached and a GC is started concurrently with the program - While the program processes the array, the GC

Re: [go-nuts] GC problem

2017-05-02 Thread Юрий Соколов
There is nowhere told that GOGC defines border that could not be reached. GOGC defines proportion that triggers GC, ie GC is triggered AFTER GOGC proportion crossed, not before. In fact, if you allocates by small portions, then GC tries to predict when you will reach this border, and tries to

[go-nuts] Re: Feedback welcome: "Shorten your URL"

2017-05-02 Thread Lutz Horn
Hi, To serve static files, you can use one of the many pre defined go http handlers, fs := http.FileServer(http.Dir("static")) http.Handle("/", fs) found this article, among many others, http://www.alexedwards.net/blog/serving-static-sites-with-go Yes, that's a good point. Reading the

[go-nuts] openid connect

2017-05-02 Thread aman
hello go community, how can i do authentication using openid for github and my local web app how to create issuer url what certificates and key i will have to generate for issuer how to make server for end-point connection for oauth2 and openid connect i am new to golang n am a noob :P please

[go-nuts] Re: Feedback welcome: "Shorten your URL"

2017-05-02 Thread mhhcbon
hi, some more sharings, like val said, https://github.com/lutzhorn/shorturl/blob/master/main.go#L42 is not optimum, get ride of the anonymous func is obvious. Note: that would have been useful in a loop iteration that spawns go routine. To go beyond, I think you can do, signatures seems to

Re: [go-nuts] GC problem

2017-05-02 Thread Serhat Sevki Dincer
The allocation request (make) is made to the runtime which covers GC, right? GC percent is also set to 10%. After 1st call returns, my app has about 2gb ram allocated. When 2nd call requests allocation, runtime cannot: - first allocate another 2gb - free the 1st buffer later due to the definition

[go-nuts] Re: [ANN] listser/mutexer/channeler: generators.

2017-05-02 Thread mhhcbon
Hi, Some more about that. I added tow new generators jsoner / httper. jsoner takes a type in input, parses method args from a json body req, output func params to a json body response. JSON-RPC. httper, takes an http req in input, interprets it as a json-rpc request, pass it to the

[go-nuts] Re: All the Go project history, live in RAM

2017-05-02 Thread mhhcbon
looks awesome! On Sunday, April 30, 2017 at 11:42:03 PM UTC+2, bradfitz wrote: > > Gophers, > > Want to analyze the Go project's Git, GitHub, and Gerrit history? > > Here a package to make it easy: > > https://godoc.org/golang.org/x/build/maintner/godata > > See the example: > > >

[go-nuts] Re: Go on AIX

2017-05-02 Thread Tony . Reix
The first (alpha) version of Gcc Go for AIX 7.1 is available on BullFreeware: http://bullfreeware.com/affichage.php?id=3614 It is an experimental version. That means that still several Go compiler and Go libgo tests are still failing and only 32 bit version has been built/tested in depth

Re: [go-nuts] Strange Go runtime behavior related to xml.Unmarshal

2017-05-02 Thread Nikos Anastopoulos
Τη Κυριακή, 30 Απριλίου 2017 - 2:36:15 π.μ. UTC+3, ο χρήστης Ian Lance Taylor έγραψε: > > On Sat, Apr 29, 2017 at 3:09 AM, Nikos Anastopoulos > wrote: > > Τη Σάββατο, 29 Απριλίου 2017 - 7:33:00 π.μ. UTC+3, ο χρήστης Nikos > > Anastopoulos έγραψε: > >> > >> Either

[go-nuts] Re: Feedback welcome: "Shorten your URL"

2017-05-02 Thread Val
Actually, html/template is good for templating, with data formatting, etc. For a static static file, consider http.ServeFile On Tuesday, May 2, 2017 at 10:03:19 AM UTC+2, Lutz Horn wrote: > > Hi Val, > > > I'll go with 2 remarks and leave other

[go-nuts] Re: go get -u doesn't update dependencies

2017-05-02 Thread Dave Cheney
One cause can be an incorrect GOPATH setting (if the source is outside GOPATH, possibly due to symlinks) On Tuesday, 2 May 2017 18:33:34 UTC+10, anatoly techtonik wrote: > > https://github.com/lxc/lxd/pull/3260 was an attempt to prevent breaking > builds due to a missing/updated dependency with

[go-nuts] go get -u doesn't update dependencies

2017-05-02 Thread anatoly techtonik
https://github.com/lxc/lxd/pull/3260 was an attempt to prevent breaking builds due to a missing/updated dependency with `go get -u`. However, this command didn't fetch it. Why? Why not to fix it? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: Feedback welcome: "Shorten your URL"

2017-05-02 Thread Lutz Horn
Hi Val, I'll go with 2 remarks and leave other concerns to other reviewers : - using ioutil.ReadFile to serve some static html isn't the most idiomatic. Have a look at html/template . I had a vague feeling that this should be easier :) Thanks, I'll

[go-nuts] Re: Feedback welcome: "Shorten your URL"

2017-05-02 Thread Val
Hello Lutz This code already looks nice, and running "go vet" doesn't even complain, great! I'll go with 2 remarks and leave other concerns to other reviewers : - using ioutil.ReadFile to serve some static html isn't the most idiomatic. Have a look at html/template

[go-nuts] "Selling" Go to Management

2017-05-02 Thread Simon Ritchie
I think interoperability is an important issue. If you are trying to introduce Go into a mature environment you need to avoid any idea that the existing apps will have to be rewritten. For example, gRPC allows a Go application to work with apps written in Java, C#, RoR, Python and a host of

[go-nuts] Feedback welcome: "Shorten your URL"

2017-05-02 Thread Lutz Horn
Hi Go Nuts, to practice my Go skills, I've implemented a simple web application that allows you to shorten an URL. The application consists of a backend written in Go and a web frontend using jQuery with some plugins and Bootstrap for layout. The code is available on GitHub at