[go-nuts] go mod tidy stop when downloading

2022-02-23 Thread Rijal Asep Nugroho
i am run go mod tidy, and always stop when downloading kafka-go. is the kafka-go library the problem? or how to find out what's going on? is there an option to view log information or something? thanks. go mod tidy go: finding module for package

Re: [go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread Kurtis Rader
On Wed, Feb 23, 2022 at 8:04 PM Mine GO BOOM wrote: > The core library should be safe and strict. It wouldn't be hard to clone > the library and make a more lenient version to be used by people who like > to append zip files to the end of images >

Re: [go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread Mine GO BOOM
The core library should be safe and strict. It wouldn't be hard to clone the library and make a more lenient version to be used by people who like to append zip files to the end of images . On Wednesday, February 23, 2022 at

Re: [go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread Kurtis Rader
On Wed, Feb 23, 2022 at 6:17 PM Pablo Caballero wrote: > The file you are trying to unzip contains "garbage" at the beginning. > That garbage looks like the sort of HTTP transaction information you'll get from `curl -v` or something similar. In other words, someone inadvertently inserted

Re: [go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread David Karr
Ok. I did that. https://github.com/golang/go/issues/51337 . On Wed, Feb 23, 2022 at 4:20 PM Ian Lance Taylor wrote: > On Wed, Feb 23, 2022 at 1:46 PM David Karr > wrote: > > > > A while ago, I wrote a small Go app that reads things from zip files. I > tested it with various zip files

Re: [go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread Ian Lance Taylor
On Wed, Feb 23, 2022 at 1:46 PM David Karr wrote: > > A while ago, I wrote a small Go app that reads things from zip files. I > tested it with various zip files (usually Java jar files), and it has always > worked perfectly fine. > > Today I'm looking at another jar file. The Java "jar"

[go-nuts] Re: Fuzz Testing in Go 1.18

2022-02-23 Thread Olupot D
It looks great, thanks. Probably edit out the last 2 minute end screen ;) On Tuesday, February 22, 2022 at 11:39:17 PM UTC+3 corin@gmail.com wrote: > Great job, a nice and gentle introduction. > > But what's with the 2 minute end screen? > > On Tuesday, 22 February 2022 at 3:53:07 am UTC+11

[go-nuts] How to debug "Not a valid zip file" from zip.OpenReader

2022-02-23 Thread David Karr
A while ago, I wrote a small Go app that reads things from zip files. I tested it with various zip files (usually Java jar files), and it has always worked perfectly fine. Today I'm looking at another jar file. The Java "jar" command likes it perfectly fine. I could list the contents and

[go-nuts] gctx: a new package for a goroutine-local context

2022-02-23 Thread Sven Anderson
Dear all, TL;DR Set a goroutine context with gctx.Set(ctx) and retrieve it from anywhere in the same or a child goroutine with gctx.Get(): https://github.com/ansiwen/gctx This topic has been discussed many times already here and in issues. Go intentionally doesn't offer a way to identify the

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread David Finkel
On Wed, Feb 23, 2022 at 1:47 PM Gergely Brautigam wrote: > Hi! > > The best way to do it is, to have these files in a folder next to the test > called `testdata` and then when the test starts, simply copy them into a > temp location. And then make your program work with an environment property >

Re: [go-nuts] Is there a way to syncronise map reads and writes?

2022-02-23 Thread Brian Candler
On Wednesday, 23 February 2022 at 13:51:23 UTC yan.z...@gmail.com wrote: > Hi Brian! > Your code with a map of channels is quite impressive! How can I test if > the code has no races in case I have many go files inside a folder? > `go build -race`? > I believe so (or "go build -race ." with

[go-nuts] Re: Migrating to go modules with package name different from VCS

2022-02-23 Thread Sean Liao
See https://pkg.go.dev/cmd/go#hdr-Remote_import_paths specifically: > The meta tag has the form: > If you serve the meta tags over HTTPS on the package path, you can point it to the appropriate git repo On Wednesday, February 23, 2022 at 2:54:25 PM UTC+1 luxif...@gmail.com wrote: > Hello, >

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread David Finkel
On Wed, Feb 23, 2022 at 8:53 AM Leam Hall wrote: > My program uses data and template files located relative to the binary. > Since go test creates the binary under test in /tmp/go-build., there > are no data or template files. How do I either specify what directory to > build in so I can

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread Amnon
Use t.TestDir() https://pkg.go.dev/testing#T.TempDir On Wednesday, 23 February 2022 at 14:37:54 UTC mlevi...@gmail.com wrote: > Use absolute paths? Feels like you're trying to bend something very hard > here > > On Wed, Feb 23, 2022 at 2:54 PM Leam Hall wrote: > >> My program uses data and

Re: [go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread Levieux Michel
Use absolute paths? Feels like you're trying to bend something very hard here On Wed, Feb 23, 2022 at 2:54 PM Leam Hall wrote: > My program uses data and template files located relative to the binary. > Since go test creates the binary under test in /tmp/go-build., there > are no data or

[go-nuts] Exporting the `copyHeader` from httputil?

2022-02-23 Thread William Perron
Hey Folks, I'm writing a proxy server type thing at the moment, I have an http.Response instance and want to copy it's headers to a ResponseWriter. Diving through the ReverseProxy server from httputil I noticed this `copyHeader` function that's pretty neat, but it's unexported. It's nothing

[go-nuts] Is there a way to specify or use the tmp directory used in testing?

2022-02-23 Thread Leam Hall
My program uses data and template files located relative to the binary. Since go test creates the binary under test in /tmp/go-build., there are no data or template files. How do I either specify what directory to build in so I can create the files, or get the tmp directory name before the

[go-nuts] [gollvm]: Build failed: error: undefined reference to 'runtime_1internal_1syscall.setErrno'

2022-02-23 Thread Richiise Nugraha
Hi, tried to build gollvm but encountered this error: libbacktrace commit: 2446c66076480ce07a6bd868badcbceb3eeecc2e libffi commit: ab1677106605aba1c27665964ff90bea59612ce3 gollvm commit: 6cd24cbc9ce21c0e6c74551e356c9323f1b1afaf gofrontend commit: aee8eddbfc3ef1b03353a060e79e7d668fb229e2 llvmorg

[go-nuts] [gollvm] Build failed: undefined reference to 'runtime_1internal_1syscall.setErrno'

2022-02-23 Thread Richiise Nugraha
Hi, tried to build gollvm but encountered this error: libbacktrace commit: 2446c66076480ce07a6bd868badcbceb3eeecc2e libffi commit: ab1677106605aba1c27665964ff90bea59612ce3 gollvm commit: 6cd24cbc9ce21c0e6c74551e356c9323f1b1afaf gofrontend commit: aee8eddbfc3ef1b03353a060e79e7d668fb229e2 llvmorg

[go-nuts] Migrating to go modules with package name different from VCS

2022-02-23 Thread Florent Viel
Hello, In my company, we are planning to migrate to go modules. The package name and VCS URL will be redacted for confidentiality. Our package name starts with `foobar.com/packagename` but the VCS URL to clone the repository is `gitlab.corp.foobar.com/foobar-groups/packagename`. We have more

[go-nuts] [gollvm] Build failed: error: undefined reference to 'runtime_1internal_1syscall.setErrno'

2022-02-23 Thread Richiise Nugraha
Hi, i encountered this error while compiling the gollvm, wonder if there is something missing: llvm commit: 09629215c272f09e3ebde6cc7eac9625d28910ff gollvm commit: 6cd24cbc9ce21c0e6c74551e356c9323f1b1afaf gofrontend commit: aee8eddbfc3ef1b03353a060e79e7d668fb229e2 libffi commit:

Re: [go-nuts] Is there a way to syncronise map reads and writes?

2022-02-23 Thread Zhaoxun Yan
Hi Brian! Your code with a map of channels is quite impressive! How can I test if the code has no races in case I have many go files inside a folder? `go build -race`? package main import "fmt" type Market struct { Price float64 `json:"price"` Timestamp string `json:"timestamp"` } type

Re: [go-nuts] Is there a way to syncronise map reads and writes?

2022-02-23 Thread robert engels
That is not correct. See https://go.dev/play/p/aZ7LostRuKR You can run this under the race detector without failure. Still, the race detector cannot detect all races so better to look at the source for sync.Map at 105

Re: [go-nuts] Re: panicOn(err) error handling

2022-02-23 Thread 'Axel Wagner' via golang-nuts
On Wed, Feb 23, 2022 at 10:50 AM Brian Candler wrote: > Of course, you should write your own programs which work in the way which > suits you best. > > If I understand your original post correctly, you are making two proposals: > > 1. Modifying the language to have some sort of shortcut for "if

Re: [go-nuts] Is there a way to syncronise map reads and writes?

2022-02-23 Thread Brian Candler
If you have a static map of mutexes, and a map of *Market, then you don't need sync.Map - because all of the accesses to the maps are read-only. If you are inserting new data sources while the program is running, then you *do* want sync.Map. On Wednesday, 23 February 2022 at 10:43:27 UTC

Re: [go-nuts] Is there a way to syncronise map reads and writes?

2022-02-23 Thread Zhaoxun Yan
Hi Brian, thanks for replying! So you mean that I have to use 5 Mutexes for Market data of each one source ? That is exactly what I want to do. Every action of RW marketMap[i] must comes in one line, but RW marketMap[j] concurrently is allowed. And mapLocks now is fine in golang? The reason why

Re: [go-nuts] Is there a way to syncronise map reads and writes?

2022-02-23 Thread Brian Candler
On Wednesday, 23 February 2022 at 08:49:26 UTC yan.z...@gmail.com wrote: > I have heard that sync.Map allows for reading simultaneously among > multiple goroutines. > It does. But it doesn't synchronize what you do with the values returned from the map. So if you retrieve a *copy* of a

[go-nuts] Re: panicOn(err) error handling

2022-02-23 Thread Brian Candler
Of course, you should write your own programs which work in the way which suits you best. If I understand your original post correctly, you are making two proposals: 1. Modifying the language to have some sort of shortcut for "if err != nil { panic(err) }" 2. Modifying Go documentation to tell

Re: [go-nuts] Is there a way to syncronise map reads and writes?

2022-02-23 Thread Zhaoxun Yan
Hi guys! Thanks for the reply. The scenario is the program booked live financial quotation feeds by a dynamic library (.so in Linux and .dll in Windows) from up to 5 different live data sources. It is like testing which CDN provides faster feeds or faster live streaming videos. It is like booking

[go-nuts] Re: Need advice on tcp socket app that needs to listen and write to the same socket

2022-02-23 Thread Jason E. Aten
Yes, that generally works quite well. I find I like to concentrate all the logic in just one of the goroutines, usually the reader goroutine, and have the writer handoff any decision making or events it requires to the reader. It is just easier to read when you find all the cases handled in

[go-nuts] Re: panicOn(err) error handling

2022-02-23 Thread Jason E. Aten
On Wednesday, February 23, 2022 at 12:33:55 AM UTC-6 Brian Candler wrote: > I don't think it's a good idea to recommend to beginners that they should > write programs that crash. Neither is teaching them a pattern that they > will have to discard as soon as they write real programs. Au