On 06/07/24, Ian Lance Taylor (i...@golang.org) wrote:
> On Sat, Jul 6, 2024 at 2:21 PM Rory Campbell-Lange
> wrote:
> >
> > I don't seem to be able to range over an iter.Seq in a template.
...
> > ...is an iter.Seq or iter.Seq2 not intended to be added there?
>
I don't seem to be able to range over an iter.Seq in a template.
error: executing "test" at <.>: range can't iterate over 0x5103c0
resulter := func(yield func(int) bool) {
for _, v := range []int{1, 2, 3} {
if !yield(v) {
On 31/05/24, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> On 23/05/24, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> > I've been playing with with rangefunc experiment...
>
> ...reference to python nested yield example...
>
> > for p in people
On 23/05/24, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> I've been playing with with rangefunc experiment...
...reference to python nested yield example...
> for p in people:
> for c in p.cars:
> for t in c.tickets:
> pri
I've been playing with with rangefunc experiment, with help from
https://go.dev/wiki/RangefuncExperiment and the possible idioms that might come
out of it (https://blog.perfects.engineering/go_range_over_funcs is a good
read).
One somewhat eccentric use of nested iterators I built in the past i
On 29/08/23, Nagaev Boris (bnag...@gmail.com) wrote:
> On Tue, Aug 29, 2023 at 5:44 PM Rory Campbell-Lange
> wrote:
> >
> > I've made an http middleware that uses http.MaxBytesReader to limit the
> > accepted size of requests.
...
> > It seems sensible to se
I've made an http middleware that uses http.MaxBytesReader to limit the
accepted size of requests.
The middleware is as follows:
func bodyLimitMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Body = http
On 06/03/23, Bruno Albuquerque (b...@gmail.com) wrote:
> You can easily get it to work, but not in a useful way I guess.
>
> https://go.dev/play/p/mq0O8OhJ1-a
>
> You could have a different template for each type you use I guess.
Thanks for that solution. I guess I could do
t.Funcs(template
Hi. I have a generic function
func slicerG[A any](s []A, i int) []A {
fmt.Println(len(s), i)
if i > len(s) {
return s
}
return s[0:i]
}
When I try to register this in a template's FuncMap, it fails with
"cannot use generic function slicerG with
I'm writing a PostgreSQL dump file to parquet converter as a hobby project.
PostgreSQL dump files are simply plain-text files containing, as the man page
puts it "the SQL commands required to reconstruct the database to the state it
was in at the time it was saved." Null SQL values are represent
On 23/09/22, Ian Davis (m...@iandavis.com) wrote:
> On Thu, 22 Sep 2022, at 11:27 PM, Rory Campbell-Lange wrote:
>
> I just wanted to respond to this part:
>
> > I suppose my question is (and forgive me if this is a terrifically naive),
> > how can one negotiate the go la
On 22/09/22, burak serdar (bser...@computer.org) wrote:
> On Thu, Sep 22, 2022 at 4:27 PM Rory Campbell-Lange
> wrote:
>
> > ...I'm interested to learn how people negotiate interface
> > interchangeability in their programmes as my query above showed a basic
> &
This email follows my email yesterday "cannot convert fs.FS zip file to
io.ReadSeeker (missing Seek)". Thanks very much to those who replied and
provided solutions.
Following that, I'm interested to learn how people negotiate interface
interchangeability in their programmes as my query above sh
On 22/09/22, 'Dan Kortschak' via golang-nuts (golang-nuts@googlegroups.com)
wrote:
> On Thu, 2022-09-22 at 00:58 +0100, Rory Campbell-Lange wrote:
> > interface conversion: *zip.checksumReader is not io.ReadSeeker:
> > missing method Seek
>
> Would it be accep
I have a program that needs to work equally for a directory of files or for the
contents of a zip file, so I'm using an fs.FS to abstract the two.
Some of the files need to be provided to a PDF importer that accepts an
io.ReadSeeker (#1).
Generally this is working fine except when trying to co
On 12/04/22, 'Sean Liao' via golang-nuts (golang-nuts@googlegroups.com) wrote:
> > output, err := os.Create(o)
> The short variable declaration you used to create `err` also shadows
> `output`.
Thanks very much for pointing out this shadowing problem.
>
> var err error
> output, err = os.Create(
I have a command line programme that can output to either stdout or a named
file. Output to stdout, as commented out in the small example below, works
fine, but not to a named file.
Attempting to write to a named file panics on go 1.17 on Linux with:
panic: runtime error: invalid memory add
On 27/06/21, Brian Candler (b.cand...@pobox.com) wrote:
> On Sunday, 27 June 2021 at 10:32:22 UTC+1 ro...@campbell-lange.net wrote:
>
> > By the way, as a golang newbie, it isn't clear to me when it is advisable
> > to use a channel for locking as opposed to a mutex. Do people tend to use
> > the
On 27/06/21, Brian Candler (b.cand...@pobox.com) wrote:
> > Shouldn't that result in a panic, even without -race?
>
> It's not *guaranteed* to panic when you make concurrent accesses to the
> same map (hence the point of the race checker). And having two structs
> refer to the same map is no di
On 26/06/21, Ian Lance Taylor (i...@golang.org) wrote:
> On Sat, Jun 26, 2021 at 3:27 PM Rory Campbell-Lange wrote:
> >
> > I'm trying to work out why I have a data race problem (on go 1.15 and 1.16).
> >
> > *SearchResults.Set is called from several
I'm trying to work out why I have a data race problem (on go 1.15 and 1.16).
*SearchResults.Set is called from several goroutines. I am trying to avoid
concurrent access to its two maps using a mutex, but this isn't working.
108 type SearchResults struct {
109 Boxes map[string][]Box
110 s
I've been working on a small service for inserting ssh certificates into
ssh forwarded agents. See https://github.com/rorycl/sshagentca
The idea is that if you have an ssh forwarded agent with a certificate signed
through the service, you can connect to any ssh server which has the
TrustedUser
22 matches
Mail list logo