Re: [go-nuts] Running "go test" modifies go.mod & go.sum

2020-10-31 Thread Amit Saha
On Sun, 1 Nov 2020, 4:07 pm Miki Tebeka, wrote: > Hi, > > I wrote a regexp linter (https://github.com/tebeka/recheck) that's using > golang.org/x/tools/go/analysis. > > To test the tool, I run "go run ./cmd/recheck testdata/ok.go" (using > os/exec). The problem is that after the test, go.mod & g

[go-nuts] Running "go test" modifies go.mod & go.sum

2020-10-31 Thread Miki Tebeka
Hi, I wrote a regexp linter (https://github.com/tebeka/recheck) that's using golang.org/x/tools/go/analysis. To test the tool, I run "go run ./cmd/recheck testdata/ok.go" (using os/exec). The problem is that after the test, go.mod & go.sum are modified since there are some external imports in

Re: [go-nuts] How to use syscall.Syscall to call a C function accept/return a structure on Windows

2020-10-31 Thread aihui zhu
for example: void D2D1MakeRotateMatrix( FLOAT angle, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix ); and a COM based function: D2D1_SIZE_F ID2D1Bitmap_GetSize(); On Saturday, October 31, 2020 at 11:40:59 PM UTC+8, Ian Lance Taylor wrote: > > On Sat, Oct 31, 2020 at 2:52 A

[go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread Victor Giordano
nice! a god old decorator example! thanks El sábado, 31 de octubre de 2020 a las 15:16:12 UTC-3, Severyn Lisovsky escribió: > for everyone interested this is the solution in Go Playground: > https://play.golang.org/p/Rxwcwhai4Gl > > On Saturday, October 31, 2020 at 7:01:08 PM UTC+1 Severyn Lisov

[go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread Severyn Lisovsky
for everyone interested this is the solution in Go Playground: https://play.golang.org/p/Rxwcwhai4Gl On Saturday, October 31, 2020 at 7:01:08 PM UTC+1 Severyn Lisovsky wrote: > Tamás Gulácsi, wow didn't know that providing bufio.Reader to > bufio.NewReader doesn't wrap your reader. Looks like th

[go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread Severyn Lisovsky
Tamás Gulácsi, wow didn't know that providing bufio.Reader to bufio.NewReader doesn't wrap your reader. Looks like this is the solution I've been looking for. Thanks! On Saturday, October 31, 2020 at 6:50:18 PM UTC+1 Tamás Gulácsi wrote: > Why do you need an access to the internal bufio.Reader?

[go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread Tamás Gulácsi
Why do you need an access to the internal bufio.Reader? If you provide a bufio.Reader to bufio.NewReader, then it will NOT create a new reader, but give back your reader. So if you keep your bufio.Reader, and give it to csv.NewReader, than you will have the same *bufio.Reader as what the csv.Re

[go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread Severyn Lisovsky
Tamás Gulácsi, this was basically my initial idea to do that, but unfortunately there is no access to internal bufio.Reader. See: https://golang.org/src/encoding/csv/reader.go#L170 peterGo, my file is ~100GB so downloading it just for sake of splitting doesn't make sense to me. I want for each w

[go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread Tamás Gulácsi
Give csv.NewReader your own *bufio.Reader. Regarding (https://pkg.go.dev/pkg/bufio/#NewReaderSize) if the underlying io.Reader is already a *bufio.Reader with a big enough size (and csv.NewReader uses the default 4k), then the underlying reader is used, no new wrapping is introduced. This way i

Re: [go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread Robert Engels
If you want to do this, create a ByteCount reader that wraps the underlying reader and pass that to the csv reader. > On Oct 31, 2020, at 9:52 AM, peterGo wrote: > >  > Severyn, > > The best way to deal with this issue is to redefine the issue. Use csv lines > not bytes as the measure. > >

Re: [go-nuts] How to use syscall.Syscall to call a C function accept/return a structure on Windows

2020-10-31 Thread Ian Lance Taylor
On Sat, Oct 31, 2020 at 2:52 AM aihui zhu wrote: > > the syscall.Syscall function accept/return only uintptr, how should i deal > with structure? > > i'm asking this question is because that i want to avoid CGo and use pure Go > in my module. What Windows function do you want to call, and what

[go-nuts] Re: Count of actually "processed" bytes from csv.Reader

2020-10-31 Thread peterGo
Severyn, The best way to deal with this issue is to redefine the issue. Use csv lines not bytes as the measure. For example, https://play.golang.org/p/unSQ5e_hqCb Peter On Friday, October 30, 2020 at 10:17:26 PM UTC-4, Severyn Lisovsky wrote: > > Hi, > > I have difficulty counting bytes that

[go-nuts] How to use syscall.Syscall to call a C function accept/return a structure on Windows

2020-10-31 Thread aihui zhu
the syscall.Syscall function accept/return only uintptr, how should i deal with structure? i'm asking this question is because that i want to avoid CGo and use pure Go in my module. thank you. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To