Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread Rob Pike
I just did a simple test with a 2M line file and it worked fine, so I suspect it's a bug in your code. But if not, please provide a complete working executable example, with data, to help identify the problem. -rob On Thu, Oct 12, 2023 at 7:39 PM 'Mark' via golang-nuts <

Re: [go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-12 Thread Jan
Thanks Tim, but my goal is to make things transparent and easy to the users of my libraries. So I don't want to force them to run Makefiles (in my case large Bazel builds for one project, Makefile for the other), install C++/Rust build tools, deal with dockers, etc. Ideally, `go get` would just

[go-nuts] Re: Why causes []any trouble in type equations?

2023-10-12 Thread Torsten Bronger
Hallöchen! Kurtis Rader writes: > On Wed, Oct 11, 2023 at 10:31 PM Torsten Bronger < > bron...@physik.rwth-aachen.de> wrote: > > 'Axel Wagner' via golang-nuts writes: > > > [...] > > > > What would this do? > > > > func F(s []any) { > >     s[0] = "Foo" > > }

[go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread 'Mark' via golang-nuts
I'm reading Debian *Package files, some of which are over 1M lines long. I used bufio.Scanner and found that it won't read past 1M lines (I'm using Go 1.21.1 linux/amd64). Is this a limitation of bufio.Scanner? If so then it ought to be in the docs. Or is it a bug? Or maybe I made a mistake

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-12 Thread Jan
Thanks Richard. Indeed, as you pointed out the downside is the bloating of the git repo, but it makes sense. But does the user have to manually clone the repository and move the `.a` file to, let's say, /usr/local/lib, or does a simple `go get` magically does everything ? On Thursday,

Re: [go-nuts] Re: Why causes []any trouble in type equations?

2023-10-12 Thread Patrick Smith
On Wed, Oct 11, 2023 at 11:31 PM Torsten Bronger < bron...@physik.rwth-aachen.de> wrote: > > 'Axel Wagner' via golang-nuts writes: > > > > > [...] > > > > > > What would this do? > > > > > > func F(s []any) { > > > s[0] = "Foo" > > > } > > > func main() { >

[go-nuts] Re: Why causes []any trouble in type equations?

2023-10-12 Thread Torsten Bronger
Hallöchen! Patrick Smith writes: > [...] > > Here F is a simple, non-generic function, with no type > parameters. It cannot be instantiated. Any attempt to explain what > this code would do if it were legal (which it should not be) > should not involve generics, type parameters, or

[go-nuts] Question about runtime.Pinner

2023-10-12 Thread Pascal Costanza
Hi, I have a question about runtime.Pinner: The documentation states that you can only pin an object when it’s the result of calling new, taking the address of a composite literal, or taking the address of a local variable. At the same time, the Go language specification states that a slice

[go-nuts] Re: Question about runtime.Pinner

2023-10-12 Thread 'Michael Knyszek' via golang-nuts
On Thursday, October 12, 2023 at 8:07:02 AM UTC-4 Pascal Costanza wrote: Hi, I have a question about runtime.Pinner: The documentation states that you can only pin an object when it’s the result of calling new, taking the address of a composite literal, or taking the address of a local

Re: [go-nuts] Question about runtime.Pinner

2023-10-12 Thread Ian Lance Taylor
On Thu, Oct 12, 2023 at 5:06 AM Pascal Costanza wrote: > > I have a question about runtime.Pinner: The documentation states that you can > only pin an object when it’s the result of calling new, taking the address of > a composite literal, or taking the address of a local variable. > > At the

Re: [go-nuts] Question about runtime.Pinner

2023-10-12 Thread 'Michael Knyszek' via golang-nuts
On Thursday, October 12, 2023 at 9:55:12 AM UTC-4 Ian Lance Taylor wrote: On Thu, Oct 12, 2023 at 5:06 AM Pascal Costanza wrote: > > I have a question about runtime.Pinner: The documentation states that you can only pin an object when it’s the result of calling new, taking the address of

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread 'Mark' via golang-nuts
I have written and attached an example that compares bufio.Reader and bufio.Scanner. Here's the output from `go run .` (a line count followed by the first error encountered): ``` Reader 1333665 Scanner 58 bufio.Scanner: token too long ``` This probably _won't_ fail on your 2M line file; it

[go-nuts] Re: Recommended way to distribute pre-compiled C-dependencies for modules using CGO ?

2023-10-12 Thread Tamás Gulácsi
Can't you build (make go build for you) those libraries? For example, see github.com/godror/godror just includes the sources of that third party library in an "odpi" subdir, and with ``` /* #cgo CFLAGS: -I./odpi/include -I./odpi/src -I./odpi/embed #include "dpi.c" */ import "C" ``` it is

Re: [go-nuts] bufio.Scanner - possible bug or doc err?

2023-10-12 Thread Ian Lance Taylor
On Thu, Oct 12, 2023 at 10:21 AM 'Mark' via golang-nuts wrote: > > The docs for bufio.Scanner do say > "Programs that need more control over error handling or large tokens, or must > run sequential scans on a reader, should use bufio.Reader instead" > Perhaps it would be more helpful to mention