gt; the source code.
> Consider embedding any files you need with "embed" and accessing them
> through io/fs.FS rather than through os calls.
>
> - sean
>
> On Fri, Jan 10, 2025 at 8:51 AM Rory Campbell-Lange
> wrote:
> >
> > Hi. I have written a small pac
for me
> :)
>
> The source is here
> https://github.com/rogpeppe/misc/blob/f64633da4fd4/cmd/base64/base64.go
>
> On Tue, 14 Jan 2025 at 14:53, Rory Campbell-Lange
> wrote:
>
> > Thanks for finding that foolish error, Brian.
> >
> > To wrap the thread up, th
j o u r , j o y e u x
> >> 010 l i o n \n
> >> 0000015
> >>
> >> % echo -n "IkJvbmpvdXIsIGpveWV1eCBsaW9uIg==" | base64 -D | hexdump -c
> >> 000 " B o n j o u r , j o y
of the count of characters
> read before eof to determine how many padding characters to synthetically add
> - if the original data is padding this will be 0 (if it was padded correctly).
>
> > On Jan 13, 2025, at 4:42 PM, Rory Campbell-Lange
> > wrote:
> >
> > AS I
IkJvbmpvdXIsIGpveWV1eCBsaW9uIg==
ok: true
decoded: "Bonjour, joyeux lion"
--
Any thoughts on that would be gratefully received.
Rory
On 13/01/25, Rory Campbell-Lange (r...@campbell-lange.net) wrote:
> Thanks very muc
e underlying io.Reader and
> >> a buffer to store the pushed-back bytes.
> >> > > NewPushbackReader: This function creates a new PushbackReader from an
> >> existing io.Reader.
> >> > > Read method: This method reads bytes from either the buffer
experimental.
> >
> >> On Jan 12, 2025, at 2:53 PM, Robert Engels wrote:
> >>
> >> You can see the two pass reader here
> >> https://stackoverflow.com/questions/20666594/how-can-i-push-bytes-into-a-reader-in-go
> >>
> >> But yea,
on.
>
> > On Jan 12, 2025, at 12:52 PM, Rory Campbell-Lange
> > wrote:
...
> > I'm attempting to rationalise the process [of avoiding reading email parts
> > into byte slices] by simply wrapping the provided io.Reader with the
> > necessary decoders to r
I'm looking to develop an alternative to an existing piece of code that reads
email parts into byte slices and then returns these after decoding.
As library users may not wish to use these email parts and because there a
multiple byte slice copies being used, I'm attempting to rationalise the
p
On 10/01/25, 'Brian Candler' via golang-nuts (golang-nuts@googlegroups.com)
wrote:
> On Thursday, 9 January 2025 at 19:49:23 UTC Roland Müller wrote:
>
> > Reason for that is that doing all DB access methods in the application
> > language (Go or Java) tends to a codebase where you have SQL code
Hi. I have written a small package with an example which runs fine locally, but
doesn't work through the web interface of either my local godoc or pkg.go.dev.
https://pkg.go.dev/github.com/rorycl/mailboxoperator@v0.0.4#example-package
The test attempts to access files in the testdata directories
Hi
The draft go 1.24 release notes at https://tip.golang.org/doc/go1.24 have a
broken link relating to generic type aliases.
https://tip.golang.org/issue/46477 has a broken POST (?!) which results in a
"open issue/46477: file does not exist". Perhaps that link should be
https://github.com/gola
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
34 matches
Mail list logo