.
Thanks!
On Tuesday, 16 June 2020 10:33:16 UTC+1, Brian Candler wrote:
>
> On Monday, 15 June 2020 21:59:21 UTC+1, Chris Hopkins wrote:
>>
>> The ubuntu default 1.14.4
>> https://dl.google.com/go/go1.14.4.src.tar.gz
>>
>
> What about the 1.14.4 precompiled binary?
Yep, the asyncpreempt has definitly made it work.(But for how long Dun Dun
Dun!!!)
Humm, interesting. Thanks I can do some more investigation now.
Kind Regards
Chris
On Monday, 15 June 2020 22:27:00 UTC+1, Ian Lance Taylor wrote:
>
> On Mon, Jun 15, 2020 at 1:59 PM Chris Hopkins &
Hi,
(Sorry I've not been active in the group for a long time - job change
caused other changes!)
I'm seeing a very strange error on building on one of my machines, in fact
I'm seeing it on any attempt to build any go project on that machine e.g.
~/home/git/src/github.com/cbehopkins/medorg$ go bu
To a first order approximation, there is no guarantee of events between any
two go processes. The scheduler is free to chose any unblocked process.
Here's what I think is happening.
go sync () // creates the sync routine
fmt.Println("0") // prints
time.Sleep(time.Second) // sends this routine to
What brought me to it was the concurrency. I spent my entire career
frustrated by not only how concurrency wasn't more of a thing in popular
languages, but also how so many people didn't seem to think it was a
problem. I pounced on Go when I heard about it. (Although I am currently
fluttering m
I've edited the example very slightly at:
https://play.golang.org/p/s7CUSbS8P3I
Let's break this down.
Think about how you might shuffle a pack of cards, a simple way is to swap
2 cards around at a time. As long as you exchange enough cards enough times
and both cards you chose are randomly pick
Hi,
I appreciate this is not possible, but realised I never understood why (so
have just been working around it).
Example code at:
https://play.golang.org/p/BgFL9T0KiC7
I can create a struct with other structs as a member. I then get all the
fields and methods associated with that member.
But yo
t
> all throw X need to implement in order to use, and catch on interfaces, not
> structs.
>
> On Oct 8, 2018, at 9:54 AM, Chris Hopkins > wrote:
>
> Thanks. Yes, that's exactly what I want, could I have Go2 now please? ;-)
>
> Okay I'll keep doing it the way
ith Marvin-like intellects.
That's way less scary than the generics proposals that worry me so much.
Thanks again
On Monday, 8 October 2018 15:33:07 UTC+1, Ian Lance Taylor wrote:
>
> On Mon, Oct 8, 2018 at 3:38 AM, Chris Hopkins > wrote:
> > Hi,
> > Could I plea
Hi,
Could I please check what current error handling best practice is?
I've gotten quite smitten with github.com/pkg/errors. I really like the
ability to create a stack of errors that trace to what is going on. However
it seems this is not an often used package - it's not available in
playground
Pondering this, my concern is that it might become too powerful. I'm scared
this will make it harder to work out what someone has done if there's too
much indirection and magic added on top. It feels like it could be a really
*really* big hammer.
I don't buy the argument " those who prefer to a
+1
IMO the place generics would be useful is reducing the use of the empty
interface and then a type switch. Otherwise I don't see quite what people
are doing that wouldn't be better done with interfaces.
In the past I mistakenly tried to declare local methods on the builtin
types. Revisiting m
There's an old Dilbert about this:
Don't know how to solve a problem? No problem! Don't hire a consultant;
hold an interview and choose the best answer you receive from all the
candidates.
I'll get my coat.
Chris
On Monday, 14 May 2018 12:35:23 UTC+1, Sankar wrote:
>
> Hi
>
> I was recently as
I would say Lazy initialisation should build code that is more robust - I
can think of few applications where that is not worth the price. So as a
rule I agree Lazy is a good place to start unless you have a good reason
not to. I also understood it was more idiomatic.
In terms of reading/debugg
>
> I think everybody here is aware that some people really want generics and
> that generics would probably be useful for everybody. Instead of restating
> that why not share what you think about this version of Go generics?
>
> IMO this is not a proven statement.
One of the things that for me
I would have expected the compiler to allowed to change:
if len(l.shared) > 0 { # the racy check for non-emptiness
l.Lock()
last := len(l.shared) - 1
to
tmp := len(l.shared)
if tmp > 0 { # the racy check for non-emptiness
l.Lock()
last := tmp - 1
I'd be interested if this were a legal opti
ted
> and doesn't allow using a function literal (so, yeah, the latter actually
> seems significantly *less* convenient).
>
> On Thu, Feb 1, 2018 at 7:51 PM, Chris Hopkins > wrote:
>
>> No, was hoping to use the interface (It's the only reason I defined it)
>
n Thursday, 1 February 2018 18:46:09 UTC, Axel Wagner wrote:
>
> On Thu, Feb 1, 2018 at 11:52 AM, Chris Hopkins > wrote:
>
>> Yeah, so having played with this. It seems that this is going to take
>> some judicious use of reflect if I'm to stand any chance of maintai
Yeah, so having played with this. It seems that this is going to take some
judicious use of reflect if I'm to stand any chance of maintaining a
flexible API, which I really hoped to avoid.
I had assumed that the point of interfaces was to avoid this. I guess from
a high level I don't see why a s
; solve, we might be able to come up with a more idiomatic design.
>>
>> On Wed, Jan 31, 2018 at 6:37 PM, Chris Hopkins > > wrote:
>>
>>> Hi
>>> Sharing my ignorance:
>>> I didn't realise that although you can switch-case on an interface, an
Hi
Sharing my ignorance:
I didn't realise that although you can switch-case on an interface, an
array of interfaces doesn't work.
https://play.golang.org/p/tD8msjCXyuZ
Any ideas on how to cope with this? I tried:
_, ok = tmp.([]Useable)
But that fails for the same reason. I can't work out how to
Hi,
I'm tidying up some code and I think this would be a great use for gofmt's
rewrite capabilities, but I can't make it work. I have some code where
error checking is missing.
In the code every instance of Set returns an error value that is not
checked, so I assumed I could write:
gofmt -w -r
Agreed.
I found the standard library and ioutil in particular a good start. YMMV.
On Friday, 19 January 2018 13:03:52 UTC, Gianguido Sorà wrote:
>
> I think that the Go source code itself is among the best sources of good
> practices and well-written Go.
>
> Il 19 gen 2018 13:52, "Keith Brown" >
Hi All,
Does anyone know of an architecture that go runs on that has non-coherent
data caches? If so, is there a mechanism in the language/tool chain to
protect against the issues of this?
Background:
I was watching a video on the go trace tool
(https://www.youtube.com/watch?v=ySy3sR1LFCQ) in t
Why not use an interface?
type TableSaver func (db *DB)
or
type TableSaver func (tx *Tx) // depending on your needs
Allowing you to:
func (t *Table) SaveTable (...) {}
Which in your example if you wanted use a different SaveTable
implementation for OtherTable you could. Otherwise it would ju
hen I get to this last few percent
stage that I was here.
Regards & Apologies
Chris
On Tuesday, 19 December 2017 11:40:36 UTC, Jan Mercl wrote:
>
> On Tue, Dec 19, 2017 at 12:05 PM Chris Hopkins > wrote:
>
> ...
>
> > was slower than:
>
> ...
>
> Wit
Hi,
I assume this is expected behaviour to most, but it went against my
expected behaviour so thought I would share.
I was benchmarking some code and in the inner loop discovered that:
if true {
funcA()
} else {
funcB()
}
was slower than:
//if true {
funcA()
//} else {
// funcB()
//}
O
On Wednesday, 13 December 2017 12:40:18 UTC, erfang...@gmail.com wrote:
>
> How can write a compiler Using C as test.exe then can use from test.exe
> compiler any where... so can write a input file like hello world
> application and generate executable file using test.exe.
>
> the compiler is t
On Wednesday, 13 December 2017 12:35:17 UTC, erfang...@gmail.com wrote:
>
> i am not tell interpreter.
>
I'm not sure if you mean interpreter here in the context of interpreted
language, or interpreter, someone who translates between human languages.
> i am tell compiler for generate a cros
ote:
>
> Could you first answer this question?
> They question may also be answered.
>
> *how can make a new compiler programming language using c without
> assembly?(a compiler then can produce executable file) ??*
>
> On Wednesday, December 13, 2017 at 3:40:05 PM UTC+3:30,
Before I answer anything else, I don't understand what you are saying with:
On Wednesday, 13 December 2017 11:49:06 UTC, erfang...@gmail.com wrote:
>
> i want research about gocompiler and want recompile main go-compiler in
> gnu/linux operation system.(ubuntu/arch)
> not recompile golang.
>
To
You keep asking the same question, I think we have a misunderstanding here.
To grossly simplify:
Way back when, the first C compilers were written in Assembly. Then someone
produced a C compiler that was written in C. Now you use a C compiler to
build a C compiler.
Some time ago the go compiler
Ah, thanks I was using build in an attempt to reduce the scope of the
problem (under the assumption that one of the things that install did under
the hood was call build).
(Also it's habit to test things locally before installing them and
overwriting the tool I am depending on with a broken vers
Hi,
I've recently re-built goimports on one of my machines and I'm having a
weird error:
$:~/home/git/src/golang.org/x/tools/cmd $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
$:~/home/git/src/golang.org/x/tools/cmd $ go bu
1 UTC+1, Marvin Renich wrote:
>
> * Marvin Renich > [171002 11:31]:
> > * Chris Hopkins > [171002 10:52]:
> > > out, err := os.Create(potential_file_name)
> > > switch t := err.(type) {
> > > case *os.PathError:
> > > switch t.
need to look at the
> string. It's rather platform specific though at that point.
>
> //jb
>
> > On 2 Oct 2017, at 15:59, Jan Mercl <0xj...@gmail.com >
> wrote:
> >
> > On Mon, Oct 2, 2017 at 2:51 PM Chris Hopkins > wrote:
> >
> >
TC+1, Chris Hopkins wrote:
>
> Yes, it has dynamic type. That doesn't mean you can't test against it.
> I thought the preferred way to to handle errors was for a package to
> expert the error variables, then you could test for those variables as in
> the above code.
>
e else to deal with".
Chris
On Monday, 2 October 2017 13:35:27 UTC+1, Jan Mercl wrote:
>
> On Mon, Oct 2, 2017 at 2:19 PM Chris Hopkins > wrote:
>
> I'm not sure I understand: error is an interface and it always has some
> dynamic type when non-nil. But that type cannot
Hi,
I'm used to doing error handling like the following:
out, err := os.Create(potential_file_name)
switch t := err.(type) {
case *os.PathError:
switch t.Err {
case os.ErrNotExist:
etc...
However I came a cropper with an error that I traced to coming out of
syscall - specifically
Hi,
I've got a reasonably performance critical piece of code that I'm trying to
profile and I suspect is being limited by the number of memory allocations
I am doing. I understand a good tool is:
go test -c . -gcflags='-m'
Which gives some very useful results. However I haven't found any real
I'm struggling to understand,
>From what I grasp this is a request for syntactic sugar to save typing:
type intOptional *int
and various new(intOptional) calls?
or is it purely about the interface to a json/xml/protobuf struct that may
have optional fields present?
If the second then surely it'
[sorry for the side question but:]
When there is the "channels are expensive" consideration, I assume that is
from a latency perspective rather than a throughput perspective.
i.e. it was my understanding that channels had a small overhead on top of a
basic lock, but otherwise added very little wo
I had written a really long answer, but I suspect I may be misunderstanding
what you are proposing. (Apologies if I misunderstand you here, but if I am
misunderstanding you, then my long answer would have been even more
patronising than i worry this already is.)
You have some code you wish to r
On Wednesday, 2 August 2017 09:46:08 UTC+1, ecstati...@gmail.com wrote:
>
> And btw, this doesn't mean that just because there are genericity and
> polymorphism in D, that I must use them.
>
> No, but the person reading your code must understand them. Not only that
but they must understand the
>
>
> Particularly, delays should be implemented using the functions in the time
>
> package, not by burning CPU cycles at the expense of other useful work
>
> that could have been done instead.
>
>
> Sure this kinda of dead loop is just an simulation about some really CPU
> intensive jobs.
>
I think what you're saying is that it's more natural and obvious that when
you have a function that changes something it would be more obvious and
simple if it actually did modify the thing you gave it.
Having to jump through hoops to actually make the change you asked for
stick is annoying.
Ye
>
>
>
> In this code,
> starting at 0,
> is case 1 not an aberration,
> is case 3 is useless
> https://play.golang.org/p/VyOfZyt7rw
>
> Note case 0 is expected to fail and might be detected.
>
>>
>> As a dumb hardware engineer I too have struggled with this in the past.
2 rules I find helped:
1) E
Hi,
Before I re-invent the wheel:
We've (all) used net.Pipe to model a network connection in testbenches. For
my purposes it would be handy if I had one that was more realistic. i.e. it
dropped some packets and re-ordered some, maybe even duplicated a few,
added (random) delays to sending etc.
N
or message mis-map as breaking the calls
into 1k size has removed the error. When I get the chance I'll try and
investigate more, but the depths of syscalls is outside my comfort zone.
Thanks
Chris
On 30 April 2017 at 01:41, Lars Seipel wrote:
> On Thu, Apr 27, 2017 at 08:55:36AM -0
So amusingly I've just had Gob report the following error:
panic: write gob_fetch.txt: host is down
It referring to a file as a host is of course understandable but it's a
little troublesome because as far as I can tell the file should be
perfectly writable having just been created and checked
Apologies for replying to myself.
Digging into the source it looks like I had misunderstood the
purpose/functionality of bytes.Buffer.
Sorry. Please ignore/delete the question.
On Wednesday, 26 April 2017 10:21:10 UTC+1, Chris Hopkins wrote:
>
> Hi,
> Random question:
> I
Hi,
Random question:
I'm just starting implementing a file cache and using a bytes.Buffer in my
testbench as a model of a perfect file.
One slight imperfection, the standard bytes.Buffer does not implement
WriteAt which I find a little odd as it does implement ReadAt.
Now this is easy enough to w
I'm not sure what you mean by the append doesn't modify the original.
Append will use the same backing store (if there is available capacity in
it) and by definition the address of the slice in question must be
invariant across its context. e.g.: https://play.golang.org/p/lBRpKSo-9P
I think of a
53 matches
Mail list logo