Aras Can Akın | 30 Apr 19:11 2016
Picon
Gravatar

[ANN] qb0.1beta: The database toolkit for go

Hello gophers,
It is my pleasure to announce the 0.1 beta release of qb. This release contains changes mainly from the feedbacks given in the previous 0.1alpha post and the irc channel. The changelog is here.

I need feedbacks & stars :)
Cheers!

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Frank Schröder | 30 Apr 13:42 2016
Picon
Gravatar

crypto/tls: Support lookup of TLSConfig.ClientCAs at runtime

Hi Gophers,

TLSConfig has a GetCertificate() method to lookup a certificate at runtime without restart of a server/connection. This allows me to implement a dynamic certificate store for TLS connections. 

I would like to support the same dynamic lookup for client certificates for authentication but the ClientCAs field in the TLSConfig is a struct and there is no equivalent GetClientCA() method in the TLSConfig struct.

Any idea how I should go about this? Should I file an issue?

Thx
Frank

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Mayank Jha | 30 Apr 13:11 2016
Picon
Gravatar

Strange behaviour with reflect and Unmarshal on time struct.

I am observing the strange behaviour upon comparing two empty time structs (using reflect deepEqual), one is the original, and the other, (original -> marshalled -> unmarshalled). The reflect comparision is giving a false result. Here is the code, https://play.golang.org/p/UQ45xEobV_. Please tell is this expected behaviour, or am I missing something ? 

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
halmstad.ving.tsun | 30 Apr 03:24 2016
Picon

godbase/fix - speedy fixed-point math

I put together a basic fixed point library with pretty decent performance compared to what I could find.

https://github.com/fncodr/godbase/tree/master/fix

Peace

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
pkaeding | 30 Apr 02:59 2016
Gravatar

best practices with expvar

The expvar package seems amazingly useful in giving me more visibility into the running state of my application.  However, I'm not clear on the best way to use it.

At its core, it looks like I should publish a Var that knows how to get the value, and serialize it to a string.  That is, when I hit /debug/vars, it will calculate the value on the fly.  My application code just needs to set it up during initialization.

However, there are a lot of helpers in the expvar package that make it easy to publish non-string values.  It seems that they are static values, though, and my application needs to refresh the values periodically.  Eg, I can publish a NewInt during initialization, and then either Add or Set it in my application code.

I can see performance and maintenance tradeoffs to both approaches. If a value is expensive to calculate, then I might not want to trigger its calculation whenever someone happens to hit /debug/vars.  On the other hand, if I otherwise ensure that nefarious users cannot hit /debug/vars, calculating on-demand will give me more accurate results, and I can only incur the cost of calculation when I need the value.

Is there a reason to prefer one way over the other?  Or does it just depend on the tradeoffs I listed?  If it depends on the tradeoffs I listed, is there a reason that I cannot easily publish a value with a closure that can calculate it?

Thanks!

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Nigel Tao | 30 Apr 01:16 2016

Re: exp/shiny opengl backend

On Sat, Apr 30, 2016 at 12:23 AM, Daniel Skinner <daniel@...> wrote:
> I ran the fluid demo last night and was surprised by the redraw rate. Now, I
> haven't seen the gldriver working yet (only tried on linux) but would
> performance still be similar?

Uh, surprised in a good way or a bad way? :-)

As for gldriver, it should be easy to try it on linux. In your
main.go, replace the

"golang.org/x/exp/shiny/driver"

import with

driver "golang.org/x/exp/shiny/driver/gldriver"

That's it.

For me, that works for the basic, goban and tile examples. I'm not
sure why it doesn't work for the fluid example, but I'm about to hop
on a plane and won't have time to debug this for some days at least.

> I've always read that texture upload is a performance killer for GL. Is that
> how this would work in shiny for gldriver?

I'm not sure that I understand the question. What's the alternative?

> Is there still a lot of headroom
> to do other GL stuff looking solely at the intended technique employed (that
> is, consideration for things probably outside the scope of shiny like
> overlaying this method on top of other opengl stuff).

I'd like to be able to do extra GL stuff with shiny, but I'm not sure
yet exactly how they would play nicely together (OpenGL is a giant
state machine that some implementations restrict to 'the main
thread'), and my shiny priorities are basic, cross-platform "package
screen" features and "package widget".

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

Daniel Theophanes | 29 Apr 23:48 2016
Picon

Re: go get, godep and dependencies management/versioning

Right now godep "wraps" the "go get" command by shelling out to it.

If godep choose to, it could instead import the vcs repo stated below. Then it could manipulate what it considers the default branch for git.

I don't think the behavior for "go get" will change here.

-Daniel

On Friday, April 29, 2016 at 2:58:45 AM UTC-7, difazio....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
Hi!
I'm sorry that you had to read several times, I probably didn't make the problem clear enough and I apologize for that. Can you elaborate more on "non using go get"? The problem I see is that there is no way with git to easily know the pointer to the remote head and I was wondering if it wouldn't make sense to define "master" to be the default branch for git. 



On Monday, April 18, 2016 at 6:05:02 PM UTC+2, Daniel Theophanes wrote:
Hi Raffaele,

After reading your problem statement a few times, my understanding is "godep restore" is partially broken due to its reliance on "go get",which recently changed it's behavior slightly.

One solution to this would be to not use "go get" but rather use https://godoc.org/golang.org/x/tools/go/vcs . By using that, you can override the git command before using it. This is my current strategy in govendor.

-Daniel


On Monday, April 18, 2016 at 8:05:12 AM UTC-7, difazio.... <at> gmail.com wrote:
Hi folks, 

TL;DR: the current workflow for go get is broken and I'm looking for a solution, if you're interested please read the wall of text below

I know these topics have been discussed several times, but I'm trying to find the right way to get dependencies management done right. In current go versions (1.6.X), a go get will not checkout master as in: https://github.com/golang/go/commit/42206598671a44111c8f726ad33dc7b265bdf669 .
While this makes sense given that we cannot (currently) assume that the default branch is "master", this leads to weird issues when using a tool like godep and its restore command. 
We know that godep is a popular tool to deal with dependencies which provides a command to "restore" dependencies which will leave the local repository in detached HEAD (it will do "git checkout <HASH>") and the only way to rollback from this operation is to go back to the default branch. Due to the fact that the git default branch could be anything, we cannot safely checkout anything else as the default branch could have changed and could be not present locally (for any reason we can't control). 
That said, I'm trying to understand how to make this process right: I see no way of automating switching between versions of packages in a bulletproof way in case we have many go programs. Godep was a nice solution that was working fine before go 1.6 (due to the checkout master). The current solution is to nevere use "godep restore", ever (which might be a solution after all). 
While I would prefer adding some assumptions like "default branch is always master", I understand that this might not be welcome. I am also aware about that, but I still think we can make package versioning right without overcomplicating it. I'm open to suggestions, comments and interesting discussions. 


Best,
Raffaele

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Alexandru Ivan | 29 Apr 22:59 2016
Picon

Re: Map of structs to nyte array

What i'm trying to do is not that special really it's just a udp server for a game i'm trying to make in C#, the original issue was that i tried serializing but it told me i had to have a string as key since json doesn't have ints as keys. My data array is in the form 

make(map[uint64]map[uint64]Vector3)
First holds all the data about the players in the respective game session(an http decides the session id).
The second map hold the players p_id (also from an http server)
So the p_id is the key to a vector3 so that i know what player is where(i might change this according to the game needs)

I don't consider this premature optimizing because i dont wanna wake up with me writting a completely bad udp server and find myself having to go back to rewrite the entire thing since i just wanna start coding the game.., i'm in the middle of learning C# as well so kinda looking forward to taht as well.

2016-04-29 23:07 GMT+03:00 Konstantin Khomoutov <flatworm-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>:
On Fri, 29 Apr 2016 21:41:51 +0300
Alexandru Ivan <alexandru.ivan.daniel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Hello and thank for answering, sorry for my delay. I've been looking
[...]

You forgot to direct this your reply to the mailing list as well.  If
you're using a mail client, use the "reply to all" or "reply to list"
actions to do that.  I re-sent my reply to you to the list; let's
continue there.

The second point is that I got confused with the word "session" in your
example; I now see they're not web sessions but rather something more
interesting, so you might really have a case for high performance.

Still, with no explanation of your real use case we can only guess.

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
bep | 29 Apr 22:45 2016
Picon
Gravatar

Re: GopherJS rant

I'm bep in https://github.com/bep/gr

That project is less than a week old, so far from feature complete and ruff around the edges, but I'm happily surprised about how simple it is to get GopherJS to talk with the JS world.

In an ideal world I would work in a pure Go project, like Vecty (https://github.com/gopherjs/vecty -- also work in progress, but bookmark it!); but my use case is this:

I have this Facebook React app with a Go backend. I want to develop it further, but I kind of hate to write JavaScript ... but ...

I have tons of React libraries in use, including the react-router and React Bootstrap etc, so I'm not too happy to rewrite all of that in Go ...

Hence a way to mix these two worlds together would be fantastic.

I just created https://github.com/bep/grouter -- bindings for the React Router... No real commits yet, but I'm testing it now...

Oh, the "gr" name was just the first name I came up with -- it makes a short Go package name ...

bep



fredag 29. april 2016 16.21.02 UTC+2 skrev Brian Ketelsen følgende:
I played with GopherJS/React bindings here:  https://github.com/bep/gr  a few days ago and found it very usable.  The bindings are so new the paint is still wet, but they look promising, and I was able to do a small react site quickly.

BK

On Friday, April 29, 2016 at 9:34:34 AM UTC-4, Steve OConnor wrote:
Thanks Joe, I think you are in for a blast of a ride.

Had a look at React earlier in the piece, and things may have improved now, but at the time there were some real gotchas with mixing React and GopherJS.  Nothing that cant be sorted though, and if so, then this is a now aging myth / FUD that needs to be dispelled.  Glad to hear that you are making progress with it.

Hear what you are saying about the JS libs, and that is true that you never want to isolate yourself so much from the rest of the world that you miss out on being able to pick the good bits from what everyone else is doing. I did find that this was a real problem with heavyweight frameworks like angular ... where pulling in some 3rd party non-angular JS lib could often become very painful, especially if that JS lib did the tiniest bit of DOM manipulation.

My impression so far is that operating in Gopherjs doesnt get that bad, as you can practically write vanilla JS in Go, or at least wrap it really thin. At worst It can be ugly,  but at least Gopher does not attempt to abstract the DOM out of the equation, so it is rarely that painful a process.  Will report back on that later when I get some more use out of it .... I have another project Im working on that makes heavy use of LeafletJS for mapping, and I will see how that goes with Gopher.

It would be really good if you could document your experiences in getting React and Gopher working together as well.  Would love to read more about that.





--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Konstantin Khomoutov | 29 Apr 21:54 2016
Picon
Picon

Re: Map of structs to nyte array

On Fri, 29 Apr 2016 21:41:51 +0300
Alexandru Ivan <alexandru.ivan.daniel@...> wrote:

> Hello and thank for answering, sorry for my delay. I've been looking
> into bson serialization and i got a little closer with it. I have one
> more question if you could help me. I'm doing this for a udp server
> that sends data every frame and i'm a little worried about
> performance, I'm curious if you know anything about bson vs
> protobufs, i've been trying to make protobufs work but i'm not sure
> if it's really that bigger difference between these 2 formats. I know
> protobufs are smaller in size but if you have any experience in any
> benchmarks or maybe if you'd think bson is a good format for a udp
> server, I'm just kind of unsure on what to do regarding this not sure
> if i should continue with bson or try and get these protobuffers to
> work. If you could direct me towrds the best approach serialization
> format wise without doing a "roll my own" approach which i will if i
> must.

Sorry, I can't have any benchmarks (and I really doubt anyone has, but
I digress), and still there's a good piece of advice about this: your
network performance does not depend on the serialization format much,
so measure the speed of encoder.

Let me explain: if you have two formats to compare (say, protobufs and
bson), and the encodings they provide are comparable in size (from
what I gather from your words, they do), you only care about the speed
they crunch the data at.  But measuring *this* is easier than
"end-to-end" network performance (for which you'd have to create a test
system, a test client, a network and all that).  Go has tools for
bencharking right in its standard package "testing" so just take your
two encoders and execute them on the same set of data while
benchmarking them using the "testing" package.

On a side note: are you sure you are not doing premature optimization?
Encoding (and the speed of encoder) does matter in certain applications
but it appears like you're about to do something like live HD video
streaming encoder while in your original message you were talking about
something like a map of (web?) session keys to their values.  Looks like
not a big deal to me...

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

John Hare | 29 Apr 22:03 2016
Picon

os.Args[0] bug on Mac with go run?

So is the value of os.Args[0] correct here? 

Why am I getting a temp dir when running via go run?



$ go version

go version go1.6.2 darwin/amd64


$ pwd

/Users/hare/go/src/testgetwd


$ cat testgetwd.go 

package main


import (

        "fmt"

        "os"

        "path/filepath"

)


func main() {

        fmt.Printf("os.Args[0]: %s\n", os.Args[0])


        fmt.Printf("PWD: %s\n", os.Getenv("PWD"))


        wd, _ := os.Getwd()

        fmt.Printf("Getwd(): %s\n", wd)


        ap, _ := filepath.Abs(filepath.Dir(os.Args[0]))

        fmt.Printf("filepath.Dir(os.Args[0]): %s\n", ap)

}


$ go build testgetwd.go


$ ./testgetwd 

os.Args[0]: ./testgetwd

PWD: /Users/hare/go/src/testgetwd

Getwd(): /Users/hare/go/src/testgetwd

filepath.Dir(os.Args[0]): /Users/hare/go/src/testgetwd


$ go run ./testgetwd.go 

os.Args[0]: /var/folders/bb/ywkhzdf517ngn683g3c5l50c0000gn/T/go-build525038303/command-line-arguments/_obj/exe/testgetwd

PWD: /Users/hare/go/src/testgetwd

Getwd(): /Users/hare/go/src/testgetwd

filepath.Dir(os.Args[0]): /var/folders/bb/ywkhzdf517ngn683g3c5l50c0000gn/T/go-build525038303/command-line-arguments/_obj/exe


 


Output on Linux seems has similar issue:


$ ./testgetwd 

os.Args[0]: ./testgetwd

PWD: /home/jh9/go/src/testgetwd

Getwd(): /home/jh9/go/src/testgetwd

filepath.Dir(os.Args[0]): /home/jh9/go/src/testgetwd


$ go run testgetwd.go 

os.Args[0]: /tmp/go-build149397783/command-line-arguments/_obj/exe/testgetwd

PWD: /home/jh9/go/src/testgetwd

Getwd(): /home/jh9/go/src/testgetwd

filepath.Dir(os.Args[0]): /tmp/go-build149397783/command-line-arguments/_obj/exe



The docs are a bit sparse!

var Args []string

Args hold the command-line arguments, starting with the program name. 



Note: I've got another app where Getwd() returns the temp path also (haven't figured out what's different with that one yet).


Anyone able to enlighten me on this? 

What should I be using to reliably get the working directory?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane