graham | 17 Apr 14:20 2014

[ANN] 3T Software Labs MongoDB tools for mgo users.

Hello fair Gophers!


I’d like to announce the availability of 3T Software Labs MongoDB tools to the mgo users (and any other MongoDB users) on this list.


To forward-thinking Gophers and MongoDB users alike, I’d like to extend a special 60-day trial of all the apps in our suite at http://3tsoftwarelabs.com/evaluation-edition using the code ‘GOLNG’.


My apologies for the spam if you’re not an mgo or MongoDB user.


If you are, I hope you enjoy our tools and find them useful.


Like many of the pioneering Go projects described on this list, we’ve just started our adventure, and would love to hear any feedback you have.



Thanks a lot,


Graham

3T Software Labs


--
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.
Nate Finch | 17 Apr 13:36 2014
Picon

filterr - sanitizing error returns

I made a little package that helps prevent consumers of your code from shooting themselves in the foot, and helps you maintain a consistent contract for your API even if the internals of your code changes.

https://godoc.org/github.com/natefinch/filterr

The basic idea is to prevent consumers from relying on undocumented errors returned from your code.  Thus, if your code always returns an os.IsNotExist in a certain case, consumers may write code to handle that error, even if it's due to an implementation detail which may later change (breaking their code). Filterr prevents this by letting you describe exactly what errors your function should return, and automatically anonymizes any other errors.

In practice, it looks like this:

func TryIt() (err error) { defer Returns(&err, os.IsNotExist, Is(MyError)) ... return err }The above function will anonymize any errors that it returns which don't satisfy os.IsNotExist, and are not equal to MyError.

The code isn't complicated, but hopefully someone will find it interesting.

--
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.
Henrik Johansson | 17 Apr 08:46 2014
Picon

Advice on configuration propagation

Hi,

I would like to be able to reliably propagate runtime configuration changes without ending up in an inconsistent state.

That sounds vague I know and unfortunately I have no code to show really since it is just being conceptualized.

The thing is I have a number of components that read and write to a database (both sql and memcache atm) some do it as part of an service call through a standard http handler and some perform other tasks asynchronously in the background.

Propagating changes to the application seems simple enough, the plan is to use etcd. The problem, which may very well have a simple solution that has not occurred to me yet, is that I think I should wait for outstanding usage of the old configuration before I start allowing usage of the new configuration.

I.e. I should allow all started transactions to finish before starting new ones with the new configuration.

This must be a common scenario right? Normally I just restart the application with the new config but the idea now is to avoid that.

It seems channels are the way to go and I have considered attaching a channel to each transaction (or whatever granularity fits) start and tracking the count that way.

Any ideas or suggestions? I am taking any suggestions and although I would prefer a solution that can work for any type of data source I think I can settle for one that works with my sql db in the first round.

Thanks,
Henrik

--
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.
Damon Zhao | 17 Apr 07:08 2014
Picon

How can I render markdown to a golang template(html or tmpl) with blackfriday?

I use the Martini framework,I have some markdown file and I want render it as HTML in tmpl/html template.

The markdown file like this:

title: A Test Demo --- ##ABC > 123

And the template file like this:

<head> <title>{{name}}</title> </head> <body> <h2>{{abc}}</h2> <blockquote> <p>{{xyz}}</p> </blockquote> </body>

I use the blackfriday parse the markdown and return []byte type,next step I wanna render the markdown file to this template and make each block to the right place,so how can I do this right way? Or use any way to do this better?

--
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.
scpayson | 17 Apr 03:33 2014
Picon

if err == nil, a helpful pattern

Hi folks,

When I look at a lot of go code, I see the following pattern:

x, err := foo()
if err != nil {
return err
}

y, err := bar(x)
if err != nil {
return err
}

z, err := baz(y)
if err != nil {
return err
}

// do something w/ z

return nil

This is cool, but comes off as a bit verbose. I've been using the following as a replacement, which I think is a bit nicer:

var (
x, y, z T
err      error 

x, err = foo()

if err == nil {
y, err = bar(x)
}

if err == nil {
z, err = baz(y)
}
 
if err == nil { 
// do something w/ z
}

return err 
 
Just curious, has anyone else used this sort of thing and found a pitfall? Or perhaps has an opinion as to why it isn't actually nice? I think it's nice =].

Sam

--
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.
Carl Menezes | 17 Apr 01:22 2014
Picon

How do I read a single character from stdin without echoing it to the screen?

I want to be able to process a character from stdin before it is displayed on screen. Is this possible in pure Go? If it is, can I also control whether or not it is displayed on screen?

--
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.
Jiacheng Guo | 16 Apr 18:38 2014
Picon

why import cycle not allowed?

Hi,
   I'm wondering why import cycle not allowed in Go. It seems to me forbid import cycle make package init() function call a bit easier to reason but it should not be a too hard issue to solve. A common use case of cyclic import for me is to declare a common interface in top level package, then make a few implementations in different sub-package, finally make some convenient function like a factory to forward specific implementation in top level package. However, forbid cyclic dependence make this process very difficult and fragile, especially when there is multiple different interface involved. Why this design choice is taken?


Best Regards,
Jiacheng Guo 

--
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.
jksmithiii | 16 Apr 19:33 2014
Picon

NewSingleHostReverseProxy timeout

Trying out some middleware/load balancing ideas, and am considering various timeout needs due to down servers, slow servers, etc. Can anyone make suggestions on this?

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.
Jiacheng Guo | 16 Apr 18:40 2014
Picon

why import cycle not allowed?

hi,
   I'm wondering why import cycle not allowed in Go. It seems to me forbid import cycle make package init() function call a bit easier to reason but it should not be a too hard issue to solve. A common use case of cyclic import for me is to declare a common interface in top level package, then make a few implementations in different sub-package, finally make some convenient function like a factory to forward specific implementation in top level package. However, forbid cyclic dependence make this process very difficult and fragile, especially when there is multiple different interface involved. Why this design choice is taken?

Best Regards,
Jiacheng Guo

--
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.
Peter Lacey | 16 Apr 18:11 2014

Function types that take an interface

This may be basic, but it's had me stumped for a while now.  I'm new to Go.

This code will not compile: http://play.golang.org/p/06FQ0oqFIF

It fails with "prog.go:23: cannot use SomeFunc (type func(Bar)) as type AnyFunc in function argument"

I suspect the problem is that Bar is not of interface{} type.  But my understanding is that everything satisfies the empty interface.  I tried various coercions and assertions, but can't figure out how to get past this.  BTW, the code is a stripped down, illustrative example of my real code.

Any help would be appreciated.

Thanks,
Pete

--
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.
farah | 16 Apr 17:47 2014
Picon

Golang Server implements a web interface

Hello!
I'm working on a golang server that will send continually  data it received from a client  to a web page (html5) !
I will now begin to implement the interface, but i have no idea from where i can begin and what should i add to the server ??
Any one could help me and tell me what should i do to ensure that function?
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 golang-nuts+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane