Java is object-oriented, Go is subject-oriented :)
On Wednesday, January 16, 2019 at 3:42:38 PM UTC+1, Victor Giordano wrote:
>
>
> As far i can get to understand the english language (i'm not a native
> speaker), the "er" seems to denotes or describe things in a more "active
> way" (the thing t
The encoding/decoding protocol is not stateless: the first time a new type
is seen, some type information is transmitted and the Encoder/Decoder
objects keep track of that. My guess is that the thing gets messed up by
the fact that you are encoding once and decoding twice.
I would rewrite your
I love playing with package reflect, which is much more powerful than
generics by the way (you can't implement gob or json with generics).
On Saturday, July 29, 2017 at 3:28:56 PM UTC+2, M P r a d e s wrote:
>
> What is overrated is the use of "interface { }" and reflection AKA runtime
> magics
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,
Here's the code on the playground to
experiment https://play.golang.org/p/GQG-g84nM2
I believe the problem is at line 9 (and 19, but line 9 is the one we
observe).
You are using ":=" (short variable declaration) to assign the newly created
data,
but that does not assign the variable in the funct
Maybe gcc.exe is the 64 version, since you installed mingw64. Have you
tried it with cgo?
On Monday, January 30, 2017 at 6:31:40 PM UTC+1, Roberto Zanotto wrote:
>
> That's strange. I'm 100% positive that i686-w64-mingw32 is 32bit
> and x86_64-w64-mingw32 is 64bit.
> The
lutely installed Mingw64 and there are only 2 gcc.exe files:
> 1. gcc.exe (seems to be 32 bit)
> 2. i686-w64-mingw32-gcc.exe (seems to be 64 bit)
> in the help of this one it says:
> -m64Generate 64bit x86-64 code.
> so must be an x64 compiler ...
>
>
I suppose the error comes from the fact that you are using the 32bit
compiler. *i686*-w64-mingw32-gcc.exe is 32bit, try with
x86_64-w64-mingw32-gcc.exe
If CC is set correctly, cgo should use that. If you are worried that
gcc.exe is being used, temporarily move gcc.exe where cgo can't find it an
17 at 7:04:36 PM UTC+1, Roberto Zanotto wrote:
>
> Hi.
>
> I'm looking at the source of mobile/gl.
> If I understand correctly, it has a mechanism to reduce the number of cgo
> calls: the gl calls are accumulated, until a "blocking" call is reached;
> when th
Hi.
I'm looking at the source of mobile/gl.
If I understand correctly, it has a mechanism to reduce the number of cgo
calls: the gl calls are accumulated, until a "blocking" call is reached;
when that happens, all the calls with associated arguments are passed at
once to a C function, which exe
time, your program can deadlock.
On Monday, October 31, 2016 at 1:35:00 PM UTC+1, seaf...@gmail.com wrote:
>
> I cannot still get it!
> Could you explain it to me?
> Thanks ahead
>
> 在 2016年10月4日星期二 UTC+8上午5:28:11,Roberto Zanotto写道:
>>
>> I get it now. Thanks for yo
https://play.golang.org/p/i7l6VAITC1
On Friday, October 21, 2016 at 8:20:38 PM UTC+2, Tong Sun wrote:
>
> Hi,
>
> How to loop over sorted array?
>
> I got "sort.Sort used as value" error:
> https://play.golang.org/p/HP30OyJVrz
>
> Thanks
>
>
--
You received this message because you are subscrib
Maybe you can solve this with atomics.
You keep an int32 that acts as mutex (0 is unocked, 1 is locked),
the Trylock is done with atomic.CompareAndSwapInt32(mu, 0, 1) and the
Unlock with atomic.StoreInt32(mu, 0).
This gives you a Trylock, but you lose the standard (blocking) Lock.
You may have to
I missed the chance to comment on github...
This also works for implementing futures and it's simple, type-safe and can
be used with select:
https://play.golang.org/p/VDT36rC5A-
Of course the syntax is not as nice as built-in futures.
On Sunday, October 16, 2016 at 2:40:32 PM UTC+2, Sokolov Yura
te:
>
> Hi,
>
> I solved it on other group too, a friend help and without remote the
> pointer. What you think?
>
> https://gist.github.com/prsolucoes/2ebc5f199632ba1d72af11b12891d229
>
> Thanks.
>
> On Friday, October 14, 2016 at 11:26:02 PM UTC-3, Roberto Zanott
The panic you get is because CollectorGoogleAnalytics does not
implement ICollector, since GetName is defined on type
*CollectorGoogleAnalytics and not CollectorGoogleAnalytics.
This works (I changed line 24): https://play.golang.org/p/SIFh3W3qhW
On Saturday, October 15, 2016 at 4:02:51 AM UTC+2
in fact the references are still being held to the original
> decoded object, which is why it stays in memory. I think.
>
> I will update this post when I learn more/figure it out, but until then if
> anyone has more thoughts i'm all ears.
>
>
> On Thursday, October 13
input"
channel and retains them?).
On Thursday, October 13, 2016 at 10:15:36 PM UTC+2, Roberto Zanotto wrote:
>
> I took a quick look at the code. There's the Receive loop, you allocate
> and decode ReceivedGobs there. As part of the ReceivedGob, a WatheverDevice
> is
I took a quick look at the code. There's the Receive loop, you allocate and
decode ReceivedGobs there. As part of the ReceivedGob, a WatheverDevice is
also allocated and decoded. Assuming there are no errors in decoding, you
do SendResult(Device), which sends the Device to the "input" channel. I
"main" is also the name of the main function, maybe try with a different
one.
On Tuesday, October 11, 2016 at 11:54:54 PM UTC+2, Dan wrote:
>
> I need following output
> [
> {
> date:'2017-07-07',
> flags: {
> a:1
> b:2
> }
> },
> {
> date:'2017-07-08',
> fl
A goroutine might try to Close while another is checking IsClosed, it is
racy no matter how you implement it.
Go with the atomic load.
On Tuesday, October 4, 2016 at 7:32:03 PM UTC+2, Ahmed (OneOfOne) W. wrote:
>
> Some of our code uses something like:
>
> type Dummy struct {
> closed int64
> }
>
ing the lock."
>
> So if you RLock and then another goroutine tries to Lock, you might
> not be able to RLock again until the first read lock is RUnlocked (and
> after the Lock+Unlock).
>
> -Caleb
>
> On Mon, Oct 3, 2016 at 1:50 PM, Roberto Zanotto > wrote:
>
Hi everyone.
I thought I understood clearly how an RWMutex is supposed to work, but the
documentation is giving me some troubles.
It says: "The lock can be held by an arbitrary number of readers"
which is fine by me, but then the following statement seems to contradict
it:
"If a goroutine holds
They definitely were on the merchandise store, seems like they're sold out.
No idea when they will be available again.
Some big Go conferences give them away for free.
On Thursday, September 29, 2016 at 8:58:47 PM UTC+2, Esteban Rodríguez
Betancourt wrote:
>
> Hello!
> I want to buy a gopher squi
If you don't care about preserving the order of the elements in the slice,
you can do something like this:
https://play.golang.org/p/6QWxWH-Oj7
The functions I used are documented here: https://golang.org/pkg/reflect/
You may want to read this blog post about
reflection: https://blog.golang.org/
https://play.golang.org/p/XjcT8wFXVV
On Friday, September 23, 2016 at 6:13:04 AM UTC+2, Lax Clarke wrote:
>
> How would someone create a function like len ?
>
> func Len(s []interface{}) would not work because compiler complains of
> type mismatch if you call it with an integer slice (for examp
's reflection is much better than what I've expected
> - and yes, I like it, I use it!
>
> On Tuesday, September 6, 2016 at 12:57:45 AM UTC+4:30, Roberto Zanotto
> wrote:
>>
>> If you want a pointer instead of the direct value, just use New instead
>> of Ze
s and put that address inside the pointer variable?
>
> On Monday, September 5, 2016 at 10:47:23 PM UTC+4:30, Roberto Zanotto
> wrote:
>>
>> I should learn to read the questions more carefully before answering -_-
>> In the code you commented out, fd.Type() is a pointer
I should learn to read the questions more carefully before answering -_-
In the code you commented out, fd.Type() is a pointer type, so the zero
value of a pointer type is a nil pointer.
If you do fd.Type().Elem() it gives you the "dereferenced" type of the
value.
So, maybe you want:
v = reflect.
I meant v = ...
On Monday, September 5, 2016 at 8:11:00 PM UTC+2, Roberto Zanotto wrote:
>
> I suppose you want to allocate a new value, since fd is nil:
> fd = reflect.New(reflect.TypeOf(fd).Elem())
>
> On Monday, September 5, 2016 at 7:28:13 PM UTC+2, dc0d wrote:
>>
>&g
I suppose you want to allocate a new value, since fd is nil:
fd = reflect.New(reflect.TypeOf(fd).Elem())
On Monday, September 5, 2016 at 7:28:13 PM UTC+2, dc0d wrote:
>
> How can I fill a pointer to point to the zero value of underlying type?
>
> Like in:
>
> if fd.Kind() == reflect.Ptr {
> if fd
n answered (although I would
> like to know!), as the solution will be the same regardless. If I need to
> always ensure that this will be a different array underneath, I need to
> write that code explicitly.
>
> Thank you,
>
> Evan
>
>
>
>
>
>
>
> O
https://golang.org/pkg/builtin/#append
If the initial slice ns has enough capacity, it will not be reallocated,
but only resliced and modified in place.
So, in your second example, ns1 and ns2 can end up being two slices that
share the same underlying array.
On Friday, July 15, 2016 at 7:28:32
Don't worry, Gosched does what you want.
I believe that "execution resumes automatically" is in the docs just to
clarify that the goroutine is not
suspended waiting for something and that no other action is required to
wake up a goroutine that calls Gosched.
On Saturday, June 25, 2016 at 11:23:0
34 matches
Mail list logo