This is something I ran into a while back, and made a library for it,
though, I prefer not to spam the mailing list. Feel free to send me a dm
and I'll send you a github link if you are interested.
On Sunday, September 1, 2019 at 3:02:52 AM UTC-7, T L wrote:
>
>
>
> On Sunday, September 1, 2019
I am trying to perform some bitwise operators, but Go is not letting me
because the mask is an uint and the values are int. Setting the mask to int
will break the code since I am shifting bits right and left and prefer the
prefix 0 when shifting right, and if I am not mistaken, Go does not have
No such thing as a 'nil channel'. You are merely setting a variable to nil,
regardless what the previous content is.
It's just that Go allows you to receive from a nil variable if that
variable's type is a channel, in which case it blocks forever.
On Sunday, September 1, 2019 at 9:03:58 AM UT
net/http's Shutdown() does not free up the port upon return, or rather it
seems a bit undefined how long it takes for the port to be reusable again.
server := &http.Server{
Addr: fmt.Sprintf(":9000"),
}
go func() {
fmt.Println("hosting...")
err := server.Listen
You need to swap elements if you want to remove them from list while
iterating it. There are two ways to do this:
First: iterate backward. This will however, will change the order of
unremoved elements.
Second: iterate forward, and will preserve the order of the unremoved
elements.
https://pl
Yes, it's a debatable subject within the Go community. See this blog for
example:
https://medium.com/@c9s/golang-the-annoying-remote-import-path-c6c7e76517e5
There are some tricks you can do using a different git remote, `git remote
add myfork github.com/yourfork/project`
Then when you push, y
Thank you for the links.
I am still somewhat disappointed that the http/2 protocol would enforce a
certain configuration. I understand the necessity of secure connections,
but that's should be left as an option to the developers.
If browsers want to strictly use TLS, that's fine because it's co
I am reading Golang's support for HTTP2, and it seems it is only enabled by
default if you use https
https://go-review.googlesource.com/c/go/+/15828
My questions are:
1. Does this mean I have to use ListenAndServeTLS() to enable http2 and if
not, it will fallback to HTTP1.1?
2. Can I explicitly
> Can you just have a field of your Context type be a value of type
> context.Context?
>
> Ian
>
I managed to do this eventually. The confusion was that my library has
multiple types of contexts and they need to be stacked in any particular
order. So at first, the values from previous (pare
I am writing a library that could use the benefit of context, but I also
want to add additional functionalities to the context my library using,
while keeping the same golang idiom of using With*() to create a new
context based off its parent.
At first, it seems that all I need to do is to sati
That makes sense. If multiple goroutines are calling that select block,
one or more could be attempting to close it.
Okay, nevermind then.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails
Assuming of course, that the channel is only intended to send closed signal
to other goroutines, rather than transporting meaningful data.
On Monday, November 6, 2017 at 4:59:51 PM UTC-8, Albert Tedja wrote:
>
> So, I just found out that closed channels always yield the zero value.
> T
So, I just found out that closed channels always yield the zero value. That
means, a closed channel inside a select statement seems to always be
guaranteed to be executed.
Since closing an already closed channel creates a panic, does this mean
then I can do this to make sure that the channel is
I don't think using separate write/read channels do anything much here. If
you are concerned goroutines reading the channel somehow slowing down the
writes, you already have a goroutine that's doing the transfer on the other
end.
On Friday, April 7, 2017 at 8:36:14 AM UTC-7, Eno Compton wrot
I was using godeps before and now govendor, and never felt 100% happy with
either one. I have some feedback of how I think the package management
tool should work from the developer perspective, and here some features
that I think is crucial.
1. Standardize the package file. With govendor, t
:
>
>
>
> On Tuesday, March 14, 2017 at 12:10:31 AM UTC+2, Albert Tedja wrote:
>>
>> I am writing a custom Locker which does a check if Lock() is being called
>> more than once and throws a panic if it does.
>> I tested it to see if I can use it with sync.Cond, and f
$ go version
go version go1.8 linux/amd64
--
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+unsubscr...@googlegroups.com.
For more options, visit https:
I am writing a custom Locker which does a check if Lock() is being called
more than once and throws a panic if it does.
I tested it to see if I can use it with sync.Cond, and for the most part,
it was running as intended, except once in a while
the panic check triggered.
Here's the dumbed down v
Great. Thanks! Looks like it's just better if I return a struct if these
goroutines are operating independently anyway.
On Monday, March 13, 2017 at 12:20:42 AM UTC-7, Konstantin Khomoutov wrote:
>
> On Sun, 12 Mar 2017 23:39:59 -0700 (PDT)
> Albert Tedja > wrote:
>
> &g
Hello,
I know map itself isn't threadsafe, but I am just wondering how threadsafe
it is if you can be absolutely sure that each goroutine accesses a
different key in the map.
Say, goroutine 1 accesses mymap["1"]
and goroutine 2 accesses mymap["2"] and so on.
Thank you in advance.
--
You recei
20 matches
Mail list logo