Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-10 Thread Tamás Gulácsi
I'd also like to change the API for passing options as Andrè suggested: by optional funcs. But everywhere - they're not to be in a Context! To put them in Context feels a hack. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

[go-nuts] Re: Network error handle

2016-12-10 Thread Lee McLoughlin
On a Dial error conn will be nil. Remove the call to conn.Close() On Saturday, 10 December 2016 23:28:36 UTC, Stannis Kozlov wrote: > > I'm trying to write simple port scanner and using "net" to check port > availability: > func sock() { > conn, err := net.Dial("tcp", "192.168.0.1:9991") > if

[go-nuts] Re: Network error handle

2016-12-10 Thread yannick . haessler
conn is probably nil if there is an error. Call Close only if there is no error. conn, err := net.Dial(...) if err != nil { // handle error } defer conn.Close() Am Sonntag, 11. Dezember 2016 00:28:36 UTC+1 schrieb Stannis Kozlov: > > I'm trying to write simple port scanner and using "net" to

[go-nuts] Network error handle

2016-12-10 Thread Stannis Kozlov
I'm trying to write simple port scanner and using "net" to check port availability: func sock() { conn, err := net.Dial("tcp", "192.168.0.1:9991") if err != nil { fmt.Printf("\n!!!:: %v", err) conn.Close() Debug return error: !!!:: dial tcp 192.168.0.1:9991: getsockopt: connection re

[go-nuts] Using gorilla/websocket with the MATLAB Engine

2016-12-10 Thread Jérémy Béjanin
I am trying to set up a small websocket server that would take in user input and send it to MATLAB via the MATLAB engine. I have tested that both the engine and the websocket work separately, but when the engine session is made in a websocket handler, I cannot seems to properly communicate with

Re: [go-nuts] Should I return a value or pointer?

2016-12-10 Thread 'Axel Wagner' via golang-nuts
also, you might think a simpler implementation could be type errorString string func (s *errorString) Error() string { return string(*s) } func New(msg string) error { return (*errorString)(&msg) } but that would allow reflection to change the string. On Sat, Dec 10, 2016 at 11:12 PM,

Re: [go-nuts] Should I return a value or pointer?

2016-12-10 Thread 'Axel Wagner' via golang-nuts
On Sat, Dec 10, 2016 at 8:10 PM, Jon wrote: > I would like to know what my default practice should be when returning > structs from functions. Should I return a value or a pointer? (Assume I > don't need the functionality of returning a pointer and my struct contains > at most one simple field so

[go-nuts] Re: Should I return a value or pointer?

2016-12-10 Thread paraiso . marc
The first question you need to ask yourself is are you going to use errors as values ( if err == myerrors.ErrValue ) or errors as types ( if e,ok:= err.(*myerrors.ErrType ; ok ) Le samedi 10 décembre 2016 20:10:26 UTC+1, Jon a écrit : > > I would like to know what my default practice should be

Re: [go-nuts] $GOROOT_BOOTSTRAP variable not found if all.bash is run with sudo

2016-12-10 Thread mudrinic . mare
Thanks! It's working flawless with -E flag. =) On Saturday, December 10, 2016 at 8:29:17 PM UTC+1, Dmitri Goutnik wrote: > > sudo sanitizes environment, you need to either pass -E option or > add GOROOT_BOOTSTRAP to env_keep in /etc/sudoers: > > Defaults env_keep += "GOROOT_BOOTSTRAP" > > On Sat,

Re: [go-nuts] $GOROOT_BOOTSTRAP variable not found if all.bash is run with sudo

2016-12-10 Thread Dmitri Goutnik
sudo sanitizes environment, you need to either pass -E option or add GOROOT_BOOTSTRAP to env_keep in /etc/sudoers: Defaults env_keep += "GOROOT_BOOTSTRAP" On Sat, Dec 10, 2016 at 1:57 PM, xMudrii wrote: > Hi, > > I have downloaded Go 1.4 binaries and moved it to `/usr/local/go1.4` for > example

Re: [go-nuts] $GOROOT_BOOTSTRAP variable not found if all.bash is run with sudo

2016-12-10 Thread mudrinic . mare
`sudo all.bash` sudo: all.bash: command not found Same for `sudo ./all.bash`. But I found out that `sudo -E bash ./all.bash` is working. So I think it's solved now. On Saturday, December 10, 2016 at 8:23:17 PM UTC+1, Jan Mercl wrote: > > > > > On Sat, Dec 10, 2016 at 8:18 PM xMudrii > > wrote:

Re: [go-nuts] $GOROOT_BOOTSTRAP variable not found if all.bash is run with sudo

2016-12-10 Thread Jan Mercl
On Sat, Dec 10, 2016 at 8:18 PM xMudrii wrote: > `sudo bash all.bash` $ sudo all.bash -- -j -- 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+unsu

[go-nuts] $GOROOT_BOOTSTRAP variable not found if all.bash is run with sudo

2016-12-10 Thread xMudrii
Hi, I have downloaded Go 1.4 binaries and moved it to `/usr/local/go1.4` for example. Also I defined GOROOT_BOOTSTRAP variable in my users `.profile` file: `export GOROOT_BOOTSTRAP=/usr/local/go1.4` I sourced file and if I run echo $GOROOT_BOOTSTRAP, it'll work correctly. When I run `bash all.b

[go-nuts] Should I return a value or pointer?

2016-12-10 Thread Jon
I would like to know what my default practice should be when returning structs from functions. Should I return a value or a pointer? (Assume I don't need the functionality of returning a pointer and my struct contains at most one simple field so a vast copy isn't needed if I return a value.) A

[go-nuts] Looking for a maintainer for honnef.co/go/augeas

2016-12-10 Thread Dominik Honnef
Hi, I'm looking for a maintainer for honnef.co/go/augeas, a set of cgo bindings for Augeas[1]. It's a relatively small library, but it hasn't been keeping up with Augeas development for the past couple of months and might be missing newer APIs. The maintainer would be responsible for all the usua

[go-nuts] [go-redis] Relation between PoolTimeout, IdleTimeout & IdleCheckFrequency

2016-12-10 Thread DM
Just cross-posting this from stackoverflow Can someone let me know the relation between PoolTimeout

Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-10 Thread André Eriksson
Daniel, I agree that multiple queries are commonplace. I was referring to multiple transactions within a single request to be rare, and when it happens you don't necessarily want to share the same (read-only, isolation level) properties. You do have a point that there is a use case for making

Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-10 Thread Daniel Theophanes
André, Thanks for the constructive feedback. I agree the signature you propose would be another way to do this. For people who care about these settings, I would expect multiple queries per request is normal and ensuring the props are the same sounds like a benefit, not a detriment. In other

Re: [go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-10 Thread André Eriksson
Daniel, I would characterize the use case you describe as a very indirect way of setting these options on transactions. That's can be a good thing when contexts are already passed around, and coming up with new ways of passing such options down through a few layers of code is some amount of wor

Re: [go-nuts] gob ignores default values, bug or feature?

2016-12-10 Thread Matthew Zimmerman
Yes, it makes them smaller I agree, however shouldn't the lack of a value on decoding be considered like a zero value was encoded? I think that is the question here. On Sat, Dec 10, 2016, 4:14 AM Jesse McNelis wrote: > On Sat, Dec 10, 2016 at 5:49 PM, Hoping White > wrote: > > Hi, all > > > >

Re: [go-nuts] weird?

2016-12-10 Thread T L
On Saturday, December 10, 2016 at 7:27:24 PM UTC+8, peterGo wrote: > > TL, > > From the law (The Go Language Specification) : > > Method Sets > > The method set of the corresponding pointer type *T is the set of all > methods declared with receiver *T or T (that is, it also contains the > metho

Re: [go-nuts] weird?

2016-12-10 Thread peterGo
TL, >From the law (The Go Language Specification) : Method Sets The method set of the corresponding pointer type *T is the set of all methods declared with receiver *T or T (that is, it also contains the method set of T). Method declarations The type of a method is the type of a function wit

Re: [go-nuts] weird?

2016-12-10 Thread T L
On Saturday, December 10, 2016 at 7:08:01 PM UTC+8, Konstantin Khomoutov wrote: > > On Sat, 10 Dec 2016 02:37:24 -0800 (PST) > T L > wrote: > > [...] > > But the spec says a method M defined for type T is also a method of > > *T. In fact, it is not accurate. T.M and (*T).M have different >

Re: [go-nuts] weird?

2016-12-10 Thread T L
On Saturday, December 10, 2016 at 6:47:43 PM UTC+8, Jan Mercl wrote: > > > > I know this. > > But the spec says a method M defined for type T is also a method of *T. > > In fact, it is not accurate. T.M and (*T).M have different signatures. > > Please cite the part of the specs > > I don't think

Re: [go-nuts] weird?

2016-12-10 Thread Konstantin Khomoutov
On Sat, 10 Dec 2016 02:37:24 -0800 (PST) T L wrote: [...] > But the spec says a method M defined for type T is also a method of > *T. In fact, it is not accurate. T.M and (*T).M have different > signatures. The spec does not say that. What you state is your interpretation of the spec. I think t

Re: [go-nuts] weird?

2016-12-10 Thread Jan Mercl
> I know this. > But the spec says a method M defined for type T is also a method of *T. > In fact, it is not accurate. T.M and (*T).M have different signatures. Please cite the part of the specs I don't think the specs say that because it's technically impossible, you have above correctly stated

Re: [go-nuts] weird?

2016-12-10 Thread T L
On Saturday, December 10, 2016 at 6:20:00 PM UTC+8, peterGo wrote: > > TL, > > If you want to be a language lawyer then you must cite the law (The Go > Language Specification) to support your argument. For example, perhaps > something like this: > > From the law: > > Method expressions > > Cons

Re: [go-nuts] weird?

2016-12-10 Thread peterGo
TL, If you want to be a language lawyer then you must cite the law (The Go Language Specification) to support your argument. For example, perhaps something like this: >From the law: Method expressions Consider a struct type T with two methods, Mv, whose receiver is of type T, and Mp, whose r

Re: [go-nuts] gob ignores default values, bug or feature?

2016-12-10 Thread Jesse McNelis
On Sat, Dec 10, 2016 at 5:49 PM, Hoping White wrote: > Hi, all > > I find that gob encoding ignores fields when they have zero values. > I wonder if this is a bug or an feature? > " If a field has the zero value for its type (except for arrays; see above), it is omitted from the transmission." ht

Re: [go-nuts] weird?

2016-12-10 Thread T L
On Saturday, December 10, 2016 at 4:11:43 PM UTC+8, Axel Wagner wrote: > > On Sat, Dec 10, 2016 at 9:00 AM, T L > > wrote: > >> >> >> On Saturday, December 10, 2016 at 3:42:34 PM UTC+8, Axel Wagner wrote: >>> >>> I don't understand. You are saying, that you want a method on a pointer >>> to Age

Re: [go-nuts] weird?

2016-12-10 Thread 'Axel Wagner' via golang-nuts
On Sat, Dec 10, 2016 at 9:00 AM, T L wrote: > > > On Saturday, December 10, 2016 at 3:42:34 PM UTC+8, Axel Wagner wrote: >> >> I don't understand. You are saying, that you want a method on a pointer >> to Age and then find it unreasonable, that you are getting a method on a >> pointer to Age? >>

Re: [go-nuts] weird?

2016-12-10 Thread T L
On Saturday, December 10, 2016 at 3:42:34 PM UTC+8, Axel Wagner wrote: > > I don't understand. You are saying, that you want a method on a pointer to > Age and then find it unreasonable, that you are getting a method on a > pointer to Age? > > If you don't want the argument to be a pointer, use