On Tue, Jan 22, 2019 at 8:33 AM wrote:
> Hi, we have the same problem of OP.
> But, in the Chris's playground there could be an error, indeed if the
> consumer
> runs slower of the producer the program ends in a deadlock.
>
> To force this behavior just add a time.Sleep() after the foor loop in m
On Fri, Jan 11, 2019 at 5:59 PM Xinhu Liu wrote:
> Hi Ian,
>
> thanks for your reply.
>
> After reading and experimenting a lot I think I understand the slight
> differences between nil and interface{} with nil value.
>
> The only thing I find confusing is that interface{}(nil) == nil returns
> t
On Wed, Dec 5, 2018 at 12:16 PM Burak Serdar wrote:
> On Wed, Dec 5, 2018 at 10:12 AM Mark Volkmann
> wrote:
> >
> > I can get a reflect.Type for a variable with the following: myType :=
> reflect.TypeOf(myVariable)
> >
> > How can I get a reflect.Type for a type I have defined?
> > For example:
On Fri, Nov 30, 2018 at 8:50 AM Michel Levieux
wrote:
> Hi guys,
>
> I've been trying to find examples of cases where it is complicated to
> structure the project because circular imports are forbidden, but I can't
> find something simple that I can show you. The thing is when I've been
> confron
t. But you can also use a --plugin flag to protoc to
tell it exactly where the plugin binary lives.
*Josh Humphries*
jh...@bluegosling.com
On Sun, Nov 18, 2018 at 4:57 PM Tharaneedharan Vilwanathan <
vdhar...@gmail.com> wrote:
> Hi All,
>
> I have a minor question. When I run
This would also
>> happen when using standard Kubernetes services (when using gRPC for
>> server-to-serve communication), as kubedns resolves a service name into a
>> single virtual IP. I'm not sure if the current state of the world regarding
>> TCP load balancers and the
he current state of the world regarding TCP load
balancers and the grpc-go project, but if it's still an issue and you run
services in Kubernetes, you can use a 3rd party resolver:
https://github.com/sercand/kuberesolver.
*Josh Humphries*
jh...@bluegosling.com
On Wed, Oct 17, 2018 at
On Wed, Sep 12, 2018 at 9:05 AM robert engels wrote:
> Hi, I am adding a remote component to my github.com/robaho/keydb project
> and decided to use gRPC.
>
> I’ve reviewed the docs, and it appears to want to be stateless - which
> given the nature of Google makes sense.
>
> But for something lik
The syntax you are looking for is:
max(test.vals...)
The ellipsis indicates that the var args are the *contents* of the slice,
as opposed to trying to pass the slice as if it were just a single element
of the var args.
*Josh Humphries*
jh...@bluegosling.com
On Wed, May 23, 2018 at 7:09
On Thu, Feb 22, 2018 at 4:56 AM, Steven Hartland
wrote:
> On 22/02/2018 09:46, andrewchambe...@gmail.com wrote:
>
> Just a list of things I like about Go, thanks everyone for the hard work:
>
> snip...
>
> Minor things that could be improved in order of importance:
>
> - Ways to express immutabil
On Thu, Feb 8, 2018 at 10:32 AM, wrote:
> I read that one of the Gang of Four has sadly died recently. To me their
> book seems to be part of American technology history and tradition and I’m
> glad to have a copy somewhere.
>
> And, for structs that need stronger encapsulation (private fields, e
ke its methods to produce. (For example, the ASM
<http://download.forge.objectweb.org/asm/asm4-guide.pdf> library for Java.)
>
> -rob
>
>
> On Thu, Feb 8, 2018 at 2:14 PM, Josh Humphries
> wrote:
>
>> FWIW, it looks like someone else has gone through this exercise:
>> https://github.co
On Wed, Feb 7, 2018 at 5:45 PM, roger peppe wrote:
> As someone totally unfamiliar with the GoF patterns, hre's my take.
> I looked at the wikipedia articles and tried to work out what
> problem I thought the pattern was trying to address and then
> wrote some Go code to do that. I'm generally in
FWIW, it looks like someone else has gone through this exercise:
https://github.com/tmrts/go-patterns
*Josh Humphries*
jh...@bluegosling.com
On Fri, Feb 2, 2018 at 12:03 PM, wrote:
> I’m looking at patterns summarized on Wikipedia from “Design Patterns:
> Elements of Reusable
ode snippets in Wikipedia -- likes more like its a
related pattern: the decorator (sometimes known as the interceptor pattern).
*Josh Humphries*
jh...@bluegosling.com
On Fri, Feb 2, 2018 at 12:03 PM, wrote:
> I’m looking at patterns summarized on Wikipedia from “Design Patterns:
> Elemen
and the
rest of your code).
*Josh Humphries*
jh...@bluegosling.com
On Thu, Feb 1, 2018 at 6:31 AM, s2gatev wrote:
> Hey there!
>
> I'm trying to convert an AppEngine flexible setup to standard environment.
> I hit a problem with a piece of code that depends on some protobuf
he field names
are upper-cased. I think this is either a bug in reflect -- which should
set StructField.PkgPath to "" since the field name is exported -- OR a bug
in the compiler which should complain that there are three fields whose
resolved name appears to be the unexported identifier
ield *T and *P.T
*T// conflicts with embedded field T and *P.T
*P.T // conflicts with embedded field T and *T
}
So it is possible that this is not a bug in the encoding/json package but
in the compiler.
*Josh Humphries*
jh...@bluegosling.com
On Mon, Jan 22, 2018 at 7:28 PM, Josh
int).
*Josh Humphries*
jh...@bluegosling.com
On Mon, Jan 22, 2018 at 5:58 PM, Dan Kortschak <
dan.kortsc...@adelaide.edu.au> wrote:
> This is sort of surprising though: https://play.golang.org/p/mjfkzIqAo_b
>
> On Mon, 2018-01-22 at 10:20 -0800, C Banning wrote:
> &
exported names (based on the type
alias names), but the field's type is simply int (which is not exported due
to starting with lower-case letter).
*Josh Humphries*
jh...@bluegosling.com
On Mon, Jan 22, 2018 at 3:12 AM, 'Axel Wagner' via golang-nuts <
golang-nuts@googlegro
("unsupported type: %T", e))*
*}*
*}*
----
*Josh Humphries*
jh...@bluegosling.com
On Thu, Jan 4, 2018 at 10:24 AM, Tong Sun wrote:
> I need a data struct / solution that I can store mixed data-types into an
> array. How to architect that?
>
>
> Details -- Consider
function that does
not capture a method receiver, and then your interpretation of whatever you
read using unsafe will likely cause memory corruption and/or a program
crash.
*Josh Humphries*
jh...@bluegosling.com
On Wed, Nov 22, 2017 at 8:46 PM, Hoping White wrote:
> Thanks J
ate a factory
method that takes a function and adapts it to the interface. And then the
value can be used both to invoke the logic (by calling the one method of
the interface) and for inspecting its concrete type and value.
----
*Josh Humphries*
jh...@bluegosling.com
On Wed, Nov 22, 2017 at 8:
s implement the expected interfaces
(this is a common pattern in Go, to make sure any change to a concrete type
to make it *not* implement a particular interface result in a compile-time
error).
*Josh Humphries*
jh...@bluegosling.com
On Mon, Nov 20, 2017 at 4:27 PM, 'Paulo Matos
you are doing, and
thus it requires you to be more explicit in both client and server code to
make it work.
*Josh Humphries*
jh...@bluegosling.com
On Wed, Nov 15, 2017 at 3:43 PM, Albert Tedja wrote:
> Thank you for the links.
>
> I am still somewhat disappointed that the http/2
o shows an example of this erroneous behavior.
Demonstrations of these issues:
https://play.golang.org/p/Qu0irn2rCF
I am guessing I should just file a bug in a Github issue, but wanted to
first check to see if this, somehow, might be expected behavior. (And if
so, to learn why.)
----
*Josh Hum
-of-week by defining the constants in order. With strings, you have to
use a custom compare function that acts on string names (ick).
*Josh Humphries*
jh...@bluegosling.com
On Sun, Oct 15, 2017 at 4:13 PM, wrote:
> Is it anything wrong just assigning string values to get rid of Str
You can't convert between maps with different types of keys or values. So
you have to copy the map into one with the correct target type:
https://play.golang.org/p/qmD2pypNbj
----
*Josh Humphries*
jh...@bluegosling.com
On Mon, Aug 21, 2017 at 10:48 AM, Tong Sun wrote:
> Hi,
&g
On Mon, Aug 21, 2017 at 9:38 AM, Henrik Johansson
wrote:
> I understand the the issue you are having. We had the same where we
> differentiate between absent string and empty string.
> It was messy with data from json but it worked.
>
> I think "int?", Optional or Maybe are not as helpful in Go a
other goroutines have completed
(e.g. cancel the context and then await, provided you've added to the wait
group for each task and each one marks their work as done on completion).
----
*Josh Humphries*
jh...@bluegosling.com
On Fri, Aug 18, 2017 at 5:19 PM, wrote:
> Thanks to both for replying
On Fri, Aug 11, 2017 at 6:22 PM, Ian Lance Taylor wrote:
> On Fri, Aug 11, 2017 at 2:51 PM, Josh Humphries
> wrote:
> >
> > It is possible to extract a map's actual value/address if it is stored in
> > the heap -- by using something like this:
> >
to
unsafe.Pointer, and vice versa, is disallowed? We're already using the
unsafe package, so I can't think of a clear reason to prevent this.
*Josh Humphries*
jh...@bluegosling.com
--
You received this message because you are subscribed to the Google Groups
"golang-nut
implement our own cancellation propagation
-- like a goroutine that will stop the server(s) when the root context gets
cancelled.
I'm curious how others tackle these kinds of concerns.
----
*Josh Humphries*
jh...@bluegosling.com
--
You received this message because you are subscribed to
On Tue, Aug 1, 2017 at 2:43 PM, roger peppe wrote:
> On 1 August 2017 at 19:33, Josh Humphries wrote:
> > On Tue, Aug 1, 2017 at 11:44 AM, roger peppe wrote:
> >>
> >> On 1 August 2017 at 13:57, Josh Humphries
> wrote:
> >> > Although that solut
On Tue, Aug 1, 2017 at 11:44 AM, roger peppe wrote:
> On 1 August 2017 at 13:57, Josh Humphries wrote:
> > Although that solution creates a heap-allocated tmp for every element in
> the
> > slice. Using an interface, the value will be inlined instead of
> > heap-allo
Although that solution creates a heap-allocated tmp for every element in
the slice. Using an interface, the value will be inlined instead of
heap-allocated if it fits without boxing (so most primitive types and
pointer types won't need heap allocation).
----
*Josh Humphries*
jh...@bluegoslin
You have to use a temporary to swap the values:
tmp := a.Interface()
a.Set(b)
b.Set(reflect.ValueOf(tmp))
*Josh Humphries*
jh...@bluegosling.com
On Mon, Jul 31, 2017 at 10:18 AM, eZio Pan wrote:
> Hello,
> I want to build a "universal slice reverser" with reflect.MakeFun
This is a problem that is usually solved in Go with code generation. You
would use a go:generate directive to generate implementations for an
interface of interest.
Something like java.lang.reflect.Proxy in Go would be very cool though.
*Josh Humphries*
jh...@bluegosling.com
On Tue, Jun 20
38 matches
Mail list logo