Kamil,
A Go interface implements a particular behavior. For example, io.Reader is
the interface that wraps the basic Read method.
type Reader interface {
Read(p []byte) (n int, err error)
}
The outcome of the Read method ranges from good to catastrophic failure.
The outcome is
On Wed, Oct 6, 2021 at 12:13 AM Jan Mercl <0xj...@gmail.com> wrote:
>
> On Wed, Oct 6, 2021 at 1:06 AM Ian Lance Taylor wrote:
>
> > I opened https://golang.org/issue/48807.
>
> Thank you.
Thanks for reporting it. It's an interesting problem.
Ian
--
You received this message because you are s
On Wed, Oct 6, 2021 at 2:35 PM Kamil Ziemian wrote:
>
> I currently read about "io" package and again I read that "io.EOF" is not
> treated as error, since it is what you expect to end file, which is almost
> tautology. At the same time it satisfies error interface and is created
> busing error
Hello,
I currently read about "io" package and again I read that "io.EOF" is not
treated as error, since it is what you expect to end file, which is almost
tautology. At the same time it satisfies error interface and is created
busing errors.New function.
I understand why this is done, doing i
You call `w.Header().Set` after you already called `w.Write` (implicitly,
in the `io.Copy`). You can't change headers after you already started
writing the body.
-> You mean the w.header().Set in err part?
axel.wa...@googlemail.com schrieb am Mittwoch, 6. Oktober 2021 um 15:23:31
UTC+2:
> Your
w.Header().Set("Content-Type", "application/xml")
w.WriteHeader(300)
these lines above before io.Copy are correct?
_, err = io.Copy(w, res.Body)
axel.wa...@googlemail.com schrieb am Mittwoch, 6. Oktober 2021 um 15:23:31
UTC+2:
> Your code is incorrect. You call `w.Header().Set` after you alrea
On Wed, 6 Oct 2021, 18:38 Renat Idrisov, wrote:
... I do use a lots of gorotines,
> but I supposed they are not mapped to OS threads that frequently.
>
The runtime attempts to limit the number of OS threads to the value of
GOMAXPROCS. However, some threads do not count against that budget, name
Thanks Jan,
that is a good explanation since I do use a lots of gorotines,
but I supposed they are not mapped to OS threads that frequently.
Correct me if I am wrong, as far as I know there is no way to recycle them.
Is it correct that any IO to socket or file makes gorotine an OS thread?
What ab
On Wed, Oct 6, 2021 at 5:43 PM Renat Idrisov wrote:
> Total allocations of golang program are about 42MB, but go runtime takes 8GB
> for in OS thread stacks.
> What am I doing wrong?
If you're on 64 bit Linux, chances are the default OS thread stack
size is 8 MB. In that case your program uses
in addition to the original question, I have found a way to get the
following memstats in a few seconds:
# runtime.MemStats
# Alloc = 22267160
# TotalAlloc = 42133760
# Sys = 8852177152
# Lookups = 0
# Mallocs = 1041166
# Frees = 805749
# HeapAlloc = 22267160
# HeapSys = 67108864
# HeapIdle = 424
Your code is incorrect. You call `w.Header().Set` after you already called
`w.Write` (implicitly, in the `io.Copy`). You can't change headers after
you already started writing the body.
My personal recommendation is to a) only write the body at the very end and
b) ignore any errors returned from w
I think you can only do that if you make sql parsing a first class language
feature - or you need to construct the query using a syntax tree of clauses
which is a PITA. Sometimes a hybrid approach - not a full orm - but an sql
helper works best so
sql.Query(table name, field list, where clause
FWIW, I like the idea of being able to write direct SQL and still have some
static type checking. ORMs are OK for simple "get" and "put", but I have
been bitten so many times where I *know* the exact SQL I want for a
particular query, but the ORM makes it so damned hard to construct it their
w
Hi All,
we copy response body from a call into *responseWriter* w.
my question is:
a) if err!=nil, it is possible that w is also not nil? Or no: if err!=nil
then w is nil.
b) the following order is correct?
I would send response body (which is in *src* (resp.Body type
io.ReadCloser)) as xml co
On Wed, 6 Oct 2021 at 12:44, Robert Engels wrote:
> Personally, I think this is overkill (the entire concept not the rog
> solution)
>
I tend to agree, but the bait was too irresistible :)
I do think that using reflection in combination with generics the way I
showed can be really useful. This
Personally, I think this is overkill (the entire concept not the rog solution)
Even with static checking there is no way to ensure that tablex has the needed
fields. Even if you could check this at compile time - it might be different at
runtime.
I don’t think the juice is worth the squeeze.
On Wed, 6 Oct 2021 at 09:21, mi...@ubo.ro wrote:
> Hi Ian ,
>
> I've modified the example towards a more specific use case. The main idea
> in the example below is to make code related to database operations(i.e
> SELECT queries) safer and easier to read. A kind of
> json.Unmarshal/Marshal for
Hi Ian ,
I've modified the example towards a more specific use case. The main idea
in the example below is to make code related to database operations(i.e
SELECT queries) safer and easier to read. A kind of
json.Unmarshal/Marshal for databases, with validation (type checking, param
numbers
On Wed, Oct 6, 2021 at 1:06 AM Ian Lance Taylor wrote:
> I opened https://golang.org/issue/48807.
Thank you.
--
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 go
erratum:
So we can't use it ...
Le mercredi 6 octobre 2021 à 09:10:03 UTC+2, Jérôme LAFORGE a écrit :
> Hi Stéphane,
> Thanks for your suggestion, it works but unfortunately it raised several
> data races as side effect.
> As it doesn't run each test in separate process.
> So we can use it.
>
>
Hi Stéphane,
Thanks for your suggestion, it works but unfortunately it raised several
data races as side effect.
As it doesn't run each test in separate process.
So we can use it.
BR,
Jérôme
Le mardi 5 octobre 2021 à 15:55:20 UTC+2, stephane@gmail.com a écrit :
> Hi Jerome,
>
> Have you tr
21 matches
Mail list logo