might claim, that for infrastructural reasons, there can be no concurrent
> requests to your server, but that would just mean that the race is not
> triggered, it’s there nevertheless.
The race detector reports on races that actually happened, not races
that could happen.
>
> Caleb
On Wed, Jun 7, 2023 at 7:05 AM Ian Lance Taylor wrote:
>
> On Tue, Jun 6, 2023 at 4:31 PM Caleb Spare wrote:
> >
> > Can someone explain why the following test shows a race between the
> > indicated lines?
> >
> > https://github.com/cespare/misc/blob/b2e2
Can someone explain why the following test shows a race between the
indicated lines?
https://github.com/cespare/misc/blob/b2e201dfbe36504c88e521e02bc5d8fbb04a4532/httprace/httprace_test.go#L12-L43
The race seems to be triggered by the very last line of the test:
get(client1)
If I comment that
Hmm, I do see a matching checksum
(6d38668862bf9772c0c1c1e0f26aa5dedea9825b33f763b81ccc4aa63df2cef9) for
go1.18.8.windows-amd64.msi.
On Tue, Nov 1, 2022 at 10:28 AM Wojciech Kaczmarek wrote:
>
> I think it's important to report that go1.18.8.windows-amd64.msi doesn't
> match the published sha25
On Thu, Apr 21, 2022 at 7:16 AM 'Bryan C. Mills' via golang-nuts
wrote:
>
> Even ENFILE and EMFILE are not necessarily blindly retriable: if the process
> has run out of files, it may be because they have leaked (for example, they
> may be reachable from deadlocked goroutines).
> If that is the
On Wed, Apr 20, 2022 at 6:46 PM 'Damien Neil' via golang-nuts
wrote:
>
> The reason for deprecating Temporary is that the set of "temporary" errors
> was extremely ill-defined. The initial issue for https://go.dev/issue/45729
> discusses the de facto definition of Temporary and the confusion res
In Go 1.18 net.Error.Temporary was deprecated (see
https://go.dev/issue/45729). However, in trying to remove it from my
code, I found one way in which Temporary is used for which there is no
obvious replacement: in a TCP server's Accept loop, when deciding
whether to wait and retry an Accept error.
Thanks for the reply.
On Fri, Feb 14, 2020 at 8:33 PM Ian Lance Taylor wrote:
>
> On Thu, Feb 13, 2020 at 1:14 PM Caleb Spare wrote:
> >
> > Hi! I have a Linux-specific question about capabilities, threads, and
> > syscalls.
> >
> > I have a Go program whi
Hi! I have a Linux-specific question about capabilities, threads, and syscalls.
I have a Go program which runs other programs with specific
capabilities set. It basically does the following:
cmd := exec.Command(...)
runtime.LockOSThread()
unix.RawSyscall(unix.CAPSET, ...)
cmd.Start()
Empirically
There is ongoing discussion here: https://github.com/golang/go/issues/30791
Unfortunately it has been taking way too long for this to get
documented. People are spending a lot of time debating what the go
directive should be in go.mod files in their projects because there is
no official recommenda
I ended up filing https://github.com/golang/go/issues/35941.
On Wed, Nov 27, 2019 at 4:26 PM Caleb Spare wrote:
>
> I'm experimenting with converting a large source tree into a Go
> module. This went pretty smoothly. However, I'm wondering why 'go mod
> tidy'
I'm experimenting with converting a large source tree into a Go
module. This went pretty smoothly. However, I'm wondering why 'go mod
tidy' and 'go mod why' print warnings about symlinks.
These look like:
$ go mod tidy
warning: ignoring symlink /path/to/some/symlink/dir
...
Where a warning line
You can read some more discussion about this recommendation at
https://github.com/golang/go/issues/22602. (That's where I propose
relaxing it somewhat, since I think the current phrasing is too
strict.)
On Tue, Sep 24, 2019 at 7:42 PM wrote:
>
> I've read the documentation recommended never to st
To summarize, there are three main concrete types in the standard
library that provide ReadSeeker functionality:
*os.File
*bytes.Reader
*strings.Reader
On Wed, May 15, 2019 at 12:33 PM Sam Mortimer wrote:
>
> There is guru
> (https://docs.google.com/document/d/1_Y9xCEMj5S-7rv2ooHpZNH15JgRT5iM74
Sometimes when working with bools I wish I could write
myBool &&= x
rather than
myBool = myBool && x
I believe that && and || are the only binary operators in the language for
which the assignment form makes sense but doesn't exist (i.e., we have +=,
&^=, >>=, and so on). So in some sense addin
On Sun, Dec 30, 2018 at 12:05 PM Ian Lance Taylor wrote:
> On Sat, Dec 29, 2018 at 11:12 PM Caleb Spare wrote:
> >
> > I noticed the following:
> >
> > package main
> >
> > func main() {
> > x := float64(1 << 3) // fine (constant expr
I noticed the following:
package main
func main() {
x := float64(1 << 3) // fine (constant expression)
v := uint(3)
x = float64(1 << v) // invalid operation: 1 << uint(v) (shift of type
float64)
_ = x
}
(playground: https://play.golang.org/p/xMhEvyMw0wg)
It's clear from the spec why the first
s the redirect response which caused this request
// to be created. This field is only populated during client
// redirects.
So the response to via[0] (first redirect) is via[1].Response, and
the response to via[len(via)-1] (last redirect) is req.Response.
On Fri, Nov 16, 2018 at 7:43 PM Caleb Spare
It seems like http.Client's CheckRedirect hook only populates the
via[n].Response for n>0 (i.e., not for the first hop). This is useful if,
for instance, you want to check the status code (301, 302, etc) of each
redirect.
Here's a playground demo: https://play.golang.org/p/cKoWVhdjKwf
I can file
What's the best substitute for "go get my/tool" in a modules world?
I used to be able to tell my users to set up Go with a GOPATH workspace and
then run "go get -u github.com/my/package". I can't find an equivalent
workflow now. The closest I can find is
GOBIN=~/bin GO111MODULES=on go get github.
On Thu, Sep 6, 2018 at 9:54 AM Ian Lance Taylor wrote:
>
> On Thu, Sep 6, 2018 at 8:20 AM, wrote:
> >
> > As I wasn't happy with some aspects of it, I've rewritten my feedback on the
> > Go 2 Generics draft and deleted the original gist. Here's the link to the
> > new gist for anybody who's inte
On Tue, Aug 21, 2018 at 3:15 PM Ian Lance Taylor wrote:
>
> On Tue, Aug 21, 2018 at 12:49 AM, Caleb Spare wrote:
> >
> > I was recently trying to write a Go program that's something like chpst or
> > setpriv: it execs another program with an altered process state
On Tue, Aug 21, 2018 at 3:09 PM Manlio Perillo
wrote:
> On Wednesday, August 22, 2018 at 12:06:15 AM UTC+2, Manlio Perillo wrote:
>>
>> On Tuesday, August 21, 2018 at 9:50:23 AM UTC+2, Caleb Spare wrote:
>>>
>>>
> > [...]
>
>
>>
>>>
>
On Tue, Aug 21, 2018 at 3:06 PM Manlio Perillo
wrote:
> On Tuesday, August 21, 2018 at 9:50:23 AM UTC+2, Caleb Spare wrote:
>>
>> I was recently trying to write a Go program that's something like chpst
>> or setpriv: it execs another program with an altered process sta
I was recently trying to write a Go program that's something like chpst or
setpriv: it execs another program with an altered process state by changing
the user ID or modifying the ambient capabilities. (My program is
Linux-specific.)
In Go, when you want to spawn another process (fork+exec in Posi
The struct field should be vals []int and then you'd call
max(test.vals...).
On Wed, May 23, 2018 at 4:09 PM Alex Dvoretskiy
wrote:
> How do you write test for variadic functions?
>
> For example I have function:
>
> func max(vals ...int) int {
> m := 0
> for _, v := range vals {
> if v > m {
>
At risk of causing more confusion, here's my understanding of the
situation after observing a lot of discussion about the memory model
over the years.
There are at least two different things one might mean when referring
to the Go memory model:
1. The written contract as specified by the language
I went ahead and optimistically filed
https://github.com/golang/go/issues/24142.
On Mon, Feb 26, 2018 at 2:35 PM, Caleb Spare wrote:
> I think that CL that would have helped me realize it was (probably)
> time.Now sooner. It certainly seems like a Pareto improvement.
>
> Howeve
7;t yet know for sure that most/all of
>>>> the runtime._ExternalCode that shows up in my program's profile is
>>>> time.Now, but that wouldn't surprise me.
>>>>
>>>> This makes me curious: would it be feasible to make the profiler
>&g
I occasionally run into this, but in my experience it's exclusively with
maps:
- Initializing empty slices is ~never necessary; (in my opinion the
"members: []int{}" from the blog post is a code smell).
- Channels need initialization but that's where the important buffered vs.
unbuffered choice is
Quick question about the Go assembler.
I'm trying to use the get_tls and related macros mentioned near the
bottom of https://golang.org/doc/asm.
Although the line
# include "go_asm.h"
doesn't give an error, subsequent lines where I use the macro fail:
get_tls(CX) // unrecognized instruction "g
You can do it with cgo. I have some code that does this:
// #include
import "C"
func init() {
clockTicksPerSec = float64(C.sysconf(C._SC_CLK_TCK))
if clockTicksPerSec != 100 {
log.Println("Unusual _SC_CLK_TCK value:", clockTicksPerSec)
}
}
var clockTicksP
> I believe that program will always print 2, however when you bring multiple
> Goroutines into the mix, I’m less sure.
I'm using examples without goroutines because the crux of our
discussion, as I understand it, is whether a plain read ('if o.done ==
0') will read the result of an atomic write
>> This expression:
>>
>> atomic.StoreUint32(&o.done, 1)
>>
>> does not just take the address of o.done. It also executes the
>> StoreUint32 function, which is defined by the sync/atomic
>> documentation to behave like '*o.done = 1'; i.e., it alters the value
>> of o.done.
>
>
> Respectfully I disa
> My argument is all that 'happens-before' is a comparison of o.done ==
> 0 happens before the address of o.done is passed to
> atomic.StoreUint32. The rest is just luck.
This expression:
atomic.StoreUint32(&o.done, 1)
does not just take the address of o.done. It also executes the
StoreUint32 fu
My argument is made without reference to registers, liveness,
inlining, or any of that.
The memory model defines certain behavior of mutexes (intuitively,
it's how you think they would work) and sync/atomic defines how
StoreUint32 behaves (it's some atomic version of *o.done = 1).
(There are deta
I'm quite certain that code is correct. There's no data race here
since the write and the non-atomic read are both inside the mutex.
The memory model rules about mutexes formalize how they serialize the
code inside them. Because the unlock happens-before the next lock, and
because sequential code
And in fact, Tv has already done that. You want https://github.com/tv42/zbase32.
On Wed, Dec 13, 2017 at 3:01 AM, roger peppe wrote:
> On 13 December 2017 at 01:23, Ian Lance Taylor wrote:
>> On Tue, Dec 12, 2017 at 3:13 PM, Jeffrey Goldberg wrote:
>>>
On Dec 12, 2017, at 9:00 AM, Ian Lanc
ls is a bash builtin. You can probably invoke the ls command with /bin/ls.
But also, passing ">" as an argument to exec.Command doesn't do what
you want. > is a redirection for a shell and exec.Command is not a
shell.
I'm not sure what you're trying to accomplish, but here are two things
you coul
I always just go with (1). This problem occurs to me and always bugs
me a little, but I file it under "issues the day is too short to worry
about". In practice when you see this in the logs
starting server on port 4567
it's clear enough what happened.
On Thu, Nov 9, 2017 at 12:16 PM, Kevin Burk
You could define multiple types:
type bySubtotal []directory
type byName []directory
which have different Sort methods.
You could also define a type that includes a func(d0, d1 directory)
bool. The SortKeys example in the sort package docs
(https://golang.org/pkg/sort/#example__sortMultiKeys) co
Dave, did you mean
go test -p 1 ./...
?
On Mon, Oct 16, 2017 at 3:46 PM, Dave Cheney wrote:
> The go tests packages in parallel (as distinct from running the tests
> within a package in parallel) by default. This is controlled with the -p
> flag, which defaults to the number of cores visible t
e time where no
goroutine has the lock is large.
On Mon, Oct 16, 2017 at 1:13 PM, Ian Davis wrote:
> This sounds like https://github.com/golang/go/issues/13086
>
> On Mon, 16 Oct 2017, at 09:01 PM, Caleb Spare wrote:
>> I have a server which is doing log processing and I'm t
I have a server which is doing log processing and I'm trying to
improve throughput. The bottleneck is access to a shared resource
protected by a sync.Mutex. The issue is that even though there are
nearly always worker goroutines blocked on Lock, only about 10% of the
time (in aggregate) is spent ru
Works for me locally. I use both gofmt and goimports; for the latter, I had
to recompile it.
https://github.com/golang/go/issues/21645 is about updating the playground.
On Tue, Aug 29, 2017 at 9:05 PM, Tong Sun wrote:
>
>
> On Wednesday, August 30, 2017 at 12:02:28 AM UTC-4, andrey mirtchovski
That's not a mistake. It's still a bug! Just doesn't seem like a very
severe one. I filed https://github.com/golang/go/issues/21631.
On Fri, Aug 25, 2017 at 3:08 PM, lukas.malkmus via golang-nuts <
golang-nuts@googlegroups.com> wrote:
> I'm sorry, I think I made a huge mistake. The malicious outp
Yeah, sorry, I misread the report.
I can't reproduce the issue. Can you give a complete runnable example.
On Fri, Aug 25, 2017 at 1:46 PM, lukas.malkmus via golang-nuts <
golang-nuts@googlegroups.com> wrote:
> It is part of the interface...
>
>
> Am Freitag, 25. August 2017 22:35:21 UTC+2 schrie
I filed https://github.com/golang/go/issues/21627. Thanks for the heads up.
On Fri, Aug 25, 2017 at 1:39 PM, Caleb Spare wrote:
> Oh, shoot. It should be part of the interface. That was part of the
> proposal:
>
> https://github.com/golang/proposal/blob/master/design/
> 4899-te
Oh, shoot. It should be part of the interface. That was part of the
proposal:
https://github.com/golang/proposal/blob/master/design/4899-testing-helper.md
but I forgot to add it.
On Fri, Aug 25, 2017 at 1:16 PM, lukas.malkmus via golang-nuts <
golang-nuts@googlegroups.com> wrote:
> I'm using he
On Thu, Jul 6, 2017 at 12:41 PM, wrote:
> Within the release notes for Go 1.9 it is stated:
> "Library functions that used to trigger stop-the-world garbage collection
> now trigger concurrent garbage collection. Specifically, runtime.GC,
> debug.SetGCPercent, and debug.FreeOSMemory, now trigger
FYI staticcheck has this check.
https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck
On Mon, May 22, 2017 at 9:41 AM, wrote:
> The other day a coworker called me to show a piece of my own code. I confess
> I got a little embarassed. The code was something like this:
>
> func f(a, b
Hi Peter,
Running your code locally (Go 1.8.1 / linux / amd64), I don't get a
statistically significant difference between the two. The benchmark
does generate a ton of garbage so the GC causes the benchmark runs to
have a pretty decent variance.
To check this kind of thing, you'll want to run th
The fact that https://github.com/golang/go/issues/5083 still hasn't
been sorted out means that it's hard to explain this to people using
officially sanctioned terminology. I usually end up just using the
phrase "reference types" along with some further description of what I
mean (in particular to d
I don't think it's off-topic. This ML is about pretty much anything
Go-related. We've had discussions about teaching Go to kids before.
On Tue, Apr 11, 2017 at 10:26 AM, Bala Natarajan
wrote:
> I did not realize that this was off-topic. My mistake.
>
> Thanks David and Konstantin for the suggesti
You probably need to rebuild dependencies. (go build -i / go test -i /
go install)
On Sun, Apr 9, 2017 at 6:52 PM, sachin walia wrote:
> Thanks for releasing update so quickly. I've noticed that my build time has
> increased in 1.8.1 compared to 1.8. Is it a regression or something that
> team is
Thanks, Ian.
On Wed, Mar 29, 2017 at 1:03 PM, Ian Lance Taylor wrote:
> On Wed, Mar 29, 2017 at 9:42 AM, Caleb Spare wrote:
>> I have a question about this runtime.KeepAlive call:
>>
>> https://github.com/golang/go/blob/041ecb697f0e867a2bb0bf219cc2fd5f77057c2e/s
Hey Axel, this is a good question that I've thought about from time to
time as well. It seems that most people in this thread have
misunderstood it :)
I personally agree with your preference as given in the examples just
because I find the code easier to read when the error return is
handled separ
I have a question about this runtime.KeepAlive call:
https://github.com/golang/go/blob/041ecb697f0e867a2bb0bf219cc2fd5f77057c2e/src/os/dir_unix.go#L68
(There are other examples in the stdlib as well, I think.)
It seems to me that, strictly speaking, KeepAlive is unnecessary here
since the compil
I hope someone else knows. I've also been confused by the difference
in the offsets in the past, and when I asked about it I was told that
the output of go tool compile -S is just different than what you write
by hand. Unfortunately I don't think that the -S output is documented.
You might have to
Filed: https://github.com/golang/go/issues/19687
On Thu, Mar 23, 2017 at 4:41 PM, 'Keith Randall' via golang-nuts
wrote:
>
>
> On Thursday, March 23, 2017 at 4:24:40 PM UTC-7, Caleb Spare wrote:
>>
>> That's very good to know. Thanks, Ian.
>>
>> Un
nalysis in general?
Caleb
On Thu, Mar 23, 2017 at 10:26 AM, Ian Lance Taylor wrote:
> On Thu, Mar 23, 2017 at 9:16 AM, Caleb Spare wrote:
>>
>> Brief follow-up: does the seeming validity of the code rely at all on
>> the fact that the indicated line is written as a sing
On Tue, Feb 21, 2017 at 3:27 PM, Ian Lance Taylor wrote:
> On Tue, Feb 21, 2017 at 2:53 PM, Caleb Spare wrote:
>> I have a program that uses unsafe in order to coerce some slices to
>> strings for use as map keys. (Avoiding these allocations ends up being
>> an important performan
You'll need to handle it yourself. Gzipped requests (unlike responses) are
somewhat nonstandard.
(With a response, the client can say it supports gzip, but with requests,
you basically have to prenegotiate it out-of-band -- at least, that's how
I've encountered it in the past.)
On Mar 4, 2017 4:5
That's much easier: yes.
On Mon, Feb 27, 2017 at 2:08 PM, Glen Newton wrote:
> Ah, I've been thinking about this issue too much and have confused myself.
>
> And, I have expressed it as an XY Problem! :-(
>
> My real question should have been: if I write a byte to a file on one
> architecture, w
What do you mean by the endianness of a single byte? Endianness is
about the order of a sequence of bytes.
On Mon, Feb 27, 2017 at 1:45 PM, Glen Newton wrote:
>
>
> Given a byte b, how do I convert it to a byte of particular endianness?
> It is not clear to me looking at "encoding/binary"
>
> (I
I don't think the behavior of that code changes. (t.Hour, etc operate
on wall time; t.Add operates on both wall and monotonic time.)
If I wanted to truncate times to hours, though, I would write code like this:
https://play.golang.org/p/el8hUeXpWK
On Mon, Feb 27, 2017 at 3:25 AM, Olivier Mengué
+rlh, austin
Interesting behavior. I would recommend filing a bug. It would be most
helpful if you can create a complete repro case including either the
production code or some minimization of it that demonstrates the same
pauses.
On Thu, Feb 23, 2017 at 10:46 AM, Oliver Beattie wrote:
> I am lo
That only applies to []byte. I have a []uint64.
On Feb 23, 2017 4:13 AM, "T L" wrote:
>
>
> On Wednesday, February 22, 2017 at 6:53:53 AM UTC+8, Caleb Spare wrote:
>>
>> I have a program that uses unsafe in order to coerce some slices to
>> strings
I have a program that uses unsafe in order to coerce some slices to
strings for use as map keys. (Avoiding these allocations ends up being
an important performance optimization to this program.)
Here's some example code that shows what I'm doing:
https://play.golang.org/p/Yye1Riv0Jj
Does this se
Like unsafe.Sizeof?
On Tue, Feb 21, 2017 at 1:56 PM, Manlio Perillo
wrote:
> Il giorno martedì 21 febbraio 2017 22:14:38 UTC+1, Ian Lance Taylor ha
> scritto:
>>
>> On Tue, Feb 21, 2017 at 9:51 AM, Manlio Perillo
>> wrote:
>> > I have noted that the intValue (and uintValue) Set method do the
>>
Hey Will, it might help to get timings for just -race and
-coverprofile (not both) to try to isolate timing increase a bit.
On Mon, Feb 20, 2017 at 12:23 PM, Ian Lance Taylor wrote:
> On Mon, Feb 20, 2017 at 12:06 PM, Will Newton wrote:
>> On Thu, Feb 16, 2017 at 9:01 PM, Chris Broadfoot wrote:
Your document is not accessible to me. (Google-internal?)
On Wed, Feb 1, 2017 at 5:18 PM, 'Keith Randall' via golang-nuts
wrote:
> I wrote up a proto-proposal for something like this a while ago.
>
> https://docs.google.com/a/google.com/document/d/18nu6QTr-ACYr5AiyP6x31SkXvuJZZaZ12lnvPTEQfgQ/pub
https://golang.org/ref/spec#Calls
Look for "As a special case, if the return values of a function or
method g are equal in number"
On Wed, Jan 25, 2017 at 4:42 PM, John Souvestre wrote:
> Then I'm still confused. Where is this inconsistency / limitation /
> non-orthogonal "syntactic sugar" def
Hi! This is great stuff.
I've written a few asm loops in order to use bit-twiddling
instructions. The ones you listed cover all of those.
One other thing to consider is rotate. The compiler does a good job of
recognizing constant rotates and it's getting better
(https://github.com/golang/go/issue
I think the bit you're missing is this:
> Within a single goroutine, the happens-before order is the order expressed by
> the program.
That is, there is an implicit happens-before between each successive
statement *within a single goroutine*.
So in the example:
- the first l.Lock() happens-bef
I've run into an annoying problem. I'm not sure if there's a solution
I've overlooked and I'm hoping you folks have some ideas for me.
I have a library that provides a function Sum64(b []byte) uint64. I
have both asm and pure-go implementations of this function, and I want
both to be as fast as po
> So my question is: Prior to go 1.8's release, how can we force float64
> values to be output in decimal? This is a problem for me specifically
> because our mobile user's report their lat/lon with six places of precision.
> Trying to dump that output to JSON causes a bunch of unusable scientific
On Fri, Oct 28, 2016 at 2:41 PM, Aldrin Leal wrote:
> Regardless, I wonder what would be the action taken if it were more than a
> "warning".
>
> Would the CoC people issue a "SP" declaration? An Index Comunitum
> Prohibitorum?
Why wonder? You can read for yourself at https://golang.org/conduct.
"goference"
On Fri, Oct 21, 2016 at 10:13 AM, Ian Lance Taylor wrote:
> On Fri, Oct 21, 2016 at 8:59 AM, T L wrote:
>>
>> Is it a good idea to remove the reference words from faq?
>> Go spec did this 3 years ago.
>
> The question makes sense and needs an answer. If someone can rewrite
> it to a
I would also like an easier way to construct pointers to ints/bools/strings.
Note that there is a way to write convoluted code that makes e.g.
&int{3} legal: https://play.golang.org/p/leP5_12IX0
AFAICT this isn't a backwards-compatibility concern, though.
Like you, I would really like &5 to work
It's explained in the text afterwards:
"This is to ensure that the lock eventually becomes available; a
blocked Lock call excludes new readers from acquiring 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 RUnl
> I'm familiar with (and greatly appreciate!) the guarantees regarding
> overflow for ordinary integer arithmetic in the Go spec
Which guarantees?
> but I've been
> unable to locate anything that reassures me that similar guarantees apply
> for the sync/atomic.Add* functions. Is there any officia
Of course now that I sent this email, I have just noticed this pprof flag:
-baseShow delta from this profile
I haven't tried it yet, but this seems like it might solve these problems.
-Caleb
On Thu, Sep 29, 2016 at 2:12 PM, Caleb Spare wrote:
> pprof gives two kinds of heap
pprof gives two kinds of heap profiles: (please let me know if any of
this is not correct)
- inuse_space -- a profile of the currently live objects/bytes on the heap
- alloc_space -- a profile of the allocated objects/bytes since program startup
When I need to figure out why my heap is so big, in
That's just how interfaces are rendered in Godoc. (Compare, for example,
io.Reader.) Concrete types (e.g., reflect.Value) have their method docs
listed explicitly.
Perhaps it looks strange because reflect.Type is an extremely large
interface. Most interfaces in the stdlib have about 1-3 methods.
You'll probably want to use encoding/binary.
But which 8 of the 32 bytes are you going to use? (or really, which 63 bits?)
-Caleb
On Fri, Sep 23, 2016 at 5:25 PM, JohnGB wrote:
> I have a byte slice 32 bytes long, and I would like to use it to generate a
> positive int64. Is there a standard w
I sincerely hope we never add YAML to the stdlib, as that would
increase the amount of YAML in the world.
> Also, it is slightly unfair to have the expectation that the community should
> support a significant format through independent OSS work.
Can you explain this? I don't follow.
-Caleb
On
You could be experiencing https://github.com/golang/go/issues/16293.
You can test this hypothesis by patching in the fix
(https://github.com/golang/go/commit/cf4f1d07a189125a8774a923a3259126599e942b)
yourself. That change will be released with Go 1.8.
-Caleb
On Fri, Sep 23, 2016 at 8:32 AM, zvia
Thanks very much for your reply, Ian. I had hoped this would not be
the answer, though :)
I think I can arrange to avoid calling from asm to Go at a minor cost.
That sounds like the best solution here.
Creating the stack map manually might be interesting exercise for
learning about this corner of
I'm trying to call a Go function from asm and I'm having trouble figuring
out the details.
(In the past I've always endeavored to avoid this situation and make all my
asm functions be leaf functions, but in my current use case it would be
most helpful to be able to call a Go helper.)
See the demo
As Dave said, you should check the error, but unfortunately I think
you'll find that time.Parse doesn't handle fractional seconds that use
a character other than . as a decimal separator.
One possible workaround would be to replace all the : with . first:
https://play.golang.org/p/h_IMQxtoVI
-Ca
If you have a data race, you lose a lot of guarantees about the
correct operation of your program. It may work today but fail
occasionally, or a future version of the compiler may break it very
badly.
See
https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-w
That's still a data race. Are you using the race detector?
On Mon, Sep 12, 2016 at 9:04 AM, sqweek E. wrote:
> Yes, through plain assignment. What problems arise from that?
>
> On Monday, September 12, 2016 at 11:21:05 PM UTC+8, Peter Bourgon wrote:
>>
>> How are you replacing the reference to th
You can do
b0 := scanner.Bytes()
b1 := make([]byte, len(b0))
copy(b0, b1)
outChannel <- b0
On Mon, Aug 29, 2016 at 8:23 PM, chris.lu via golang-nuts
wrote:
> I am reading a file line by line, and send it to a chan []byte, and consume
> it on another goroutine.
>
> However, I found I must create
On Wed, Jul 27, 2016 at 9:42 AM, Andy Balholm wrote:
> in github.com/andybalholm/redwood, one thing I do is to check each URL
> against a (potentially very large) set of regular expressions. Since these
> regular expressions generally contain fairly significant amounts of literal
> text, I analyz
Reduce: yes, remove: not that I'm aware of.
https://github.com/golang/go/issues/9704
https://github.com/golang/go/issues/16051
Much of the overhead is due to defer -- cgo calls have multiple defers.
https://github.com/golang/go/issues/14939
https://github.com/golang/go/issues/6980
-Caleb
On Th
https://golang.org/doc/faq#nil_error
Make Validate return error, not MultiError.
-Caleb
On Fri, Jul 1, 2016 at 5:04 PM, Kevin Manley wrote:
> I am new to Go so I'm sure this is just me misunderstanding how things work,
> but I was surprised at this result. Please can someone help me understand
> To see if the the
> race detector would find this potential bug for me, I ran the code with the
> mutex(s) commented out with the -race flag on and didn't get a warning.
Did you make some concurrent requests? The race detector only tells
you about races that happen, so you need to excercise the
0.207ms.
>
> On Wed, Jun 22, 2016 at 5:55 PM, Caleb Spare wrote:
>>
>> Hi,
>>
>> I'm looking at GC statistics using both GODEBUG=gctrace=1 and
>> debug.ReadGCStats. My question is: should the pause durations reported
>> in debug.GCStats match the sum o
Hi,
I'm looking at GC statistics using both GODEBUG=gctrace=1 and
debug.ReadGCStats. My question is: should the pause durations reported
in debug.GCStats match the sum of the two STW phases listed in the
gctrace?
I ask because they are generally close but not the same. I have a
trivial program (h
1 - 100 of 101 matches
Mail list logo