Re: [go-nuts] Alignment guarantees of heap allocations

2024-10-12 Thread David Finkel
On Fri, Oct 11, 2024 at 3:25 AM 'Timo Beckers' via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Fri, 11 Oct 2024 at 03:15, Robert Engels wrote: > > > > That’s what I was thinking. Thanks for providing the details. Rule of > thumb - if you’re trying to do something and you’re the only o

[go-nuts] How to define struct with defined properties that is also a map

2024-09-12 Thread David Karr
This is probably basic, but I'm working on some code that unmarshals JIRA tickets (just for some context). Examining the Json output, there is a big "fields" object that mostly contains custom fields, but also some defined fields. Right now, I defined "Fields" as a "map[string]any", which is approp

Re: [go-nuts] Re: Is []rune(invalidUTF8str) underspecified?

2024-07-09 Thread &#x27;David Anderson' via golang-nuts
On Tue, Jul 9, 2024, at 19:46, Ian Lance Taylor wrote: > On Tue, Jul 9, 2024 at 5:24 PM 'David Anderson' via golang-nuts > wrote: > > > > In practice, as you point out, the original Go implementation does the > > obvious thing and reuses the range iteration beh

Re: [go-nuts] Re: Is []rune(invalidUTF8str) underspecified?

2024-07-09 Thread &#x27;David Anderson' via golang-nuts
On Tue, Jul 9, 2024, at 15:22, peterGo wrote: > > On Tuesday, July 9, 2024 at 3:42:51 PM UTC-4 David Anderson wrote: >> __ >> I've been going over the spec to clarify finer points of how string vs. >> []byte behave, I think there may be an unnecessary degree of free

[go-nuts] Is []rune(invalidUTF8str) underspecified?

2024-07-09 Thread &#x27;David Anderson' via golang-nuts
I've been going over the spec to clarify finer points of how string vs. []byte behave, I think there may be an unnecessary degree of freedom that could be removed. Either that, or I missed a load-bearing statement that constrains implementations. In https://go.dev/ref/spec#Conversions, `[]rune(

[go-nuts] Re: `go fix ./...` in go1.22.4 is reporting invalid go version

2024-06-13 Thread David Ševčík
3:54:10 PM UTC+2 David Ševčík wrote: > Hello guys, > when I run locally or in CircleCI <https://circleci.com/> command `go fix > ./...` it reports this error multiple times: > go fix ./... > invalid -go=go1.22.0 > exit status 2 > invalid -go=go1.22.0 > exit status 2 &g

[go-nuts] `go fix ./...` in go1.22.4 is reporting invalid go version

2024-06-12 Thread David Ševčík
Hello guys, when I run locally or in CircleCI command `go fix ./...` it reports this error multiple times: go fix ./... invalid -go=go1.22.0 exit status 2 invalid -go=go1.22.0 exit status 2 invalid -go=go1.22.0 exit status 2 invalid -go=go1.22.0 exit status 2 invalid -go=go

[go-nuts] Re: golang as ML backend v/s C++

2024-04-14 Thread David Green
Yeah, You are right. I has experience of developing backend with Golang. But it was difficult because it has no bigcommunity. I want to make a big community of golang backend. On Sunday, April 14, 2024 at 9:15:51 PM UTC+9 envee wrote: > After reading briefly about ML and how Python is used as a "

[go-nuts] Using client-go to access a specific context, not current context

2024-02-25 Thread David Karr
I'm relatively new to golang, although I'm pretty familiar with Kubernetes. I want to see if I can use client-go as a framework for a set of scripts that get (or set) information on a specific cluster. I don't want to use the current context, I want to set the context name on the command line

Re: [go-nuts] How to have a raw parameter value in cobra?

2024-02-25 Thread David Karr
process the > 1st parameter > // Then > rootCmd.SetArgs(os.Args[2:]) > rootCmd.Execute() > } > > On Sun, Feb 25, 2024 at 1:50 PM David Karr wrote: > > > > But where would that be done? I'm not certain of the exact role of the > "rootCmd.Execute(

Re: [go-nuts] How to have a raw parameter value in cobra?

2024-02-25 Thread David Karr
process the first > parameter yourself. > > On Sun, Feb 25, 2024 at 11:43 AM David Karr wrote: > > > > I am not a new programmer, but I am pretty new to golang, having only > written a couple of small applications, and that was several months ago. > I'm trying t

[go-nuts] How to have a raw parameter value in cobra?

2024-02-25 Thread David Karr
I am not a new programmer, but I am pretty new to golang, having only written a couple of small applications, and that was several months ago. I'm trying to construct an application using Cobra, using some nonstandard conventions. Is it better to ask a question like this in an issue in the Cobr

Re: [go-nuts] Go 1.22 code simplification

2024-01-16 Thread David Finkel
I don't know of anything that does those rewrites (and haven't looked), but it looks like gofmt -s could support it by extending this type-switch: https://cs.opensource.google/go/go/+/master:src/cmd/gofmt/simplify.go;l=16-103;drc=9b89c380208ea2e85985ee6bf2b1d684274dfa1d I like the idea of an autom

[go-nuts] Re: Go 1.22 Release Candidate 1 is released

2023-12-24 Thread John David Lee
This is in the section titled "Why are yield functions limited to at most two arguments?" On Sunday, December 24, 2023 at 5:43:23 PM UTC+1 John David Lee wrote: > Hello. > > In the rangefunc experiment document > <https://go.dev/wiki/RangefuncExperiment> the iter

[go-nuts] Re: Go 1.22 Release Candidate 1 is released

2023-12-24 Thread John David Lee
ackage exposes a slightly different interface: type Seq[V any] func(yield func(V) bool) type Seq2[K, V any] func(yield func(K, V) bool) Take care, David On Wednesday, December 20, 2023 at 12:43:36 AM UTC+1 anno...@golang.org wrote: > Hello gophers, > > We have just released go1.2

Re: [go-nuts] Generic assembly function

2023-12-19 Thread David Finkel
On Thu, Dec 14, 2023 at 10:43 PM Clément Jean wrote: > Hi, > > I'm currently learning how to write Go assembly on arm64 and I made the > following functions: > > TEXT ·AddVector16(SB),NOSPLIT,$0-48 > MOVD a+0(FP), R0 > MOVD a+8(FP), R1 > MOVD a+16(FP), R2 > MOVD a+24(FP), R3 > VMOV R0, V0.D[0] >

Re: [go-nuts] I need confirmation about whether I'm in front of a linter false positive.

2023-08-14 Thread David Finkel
On Mon, Aug 14, 2023 at 4:54 PM Pablo Caballero wrote: > I started working on a Golang project (from my work). The following > pattern makes the company configured linter to complain with: > sloppyReassign: re-assignment to `err` can be replaced with `err := > myFunc2()` (gocritic) > > func myFun

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread David N
Yup, this makes sense and should work, but I'm still surprised this can't be entirely done in Golang. On Mon, Jul 24, 2023 at 10:49 AM Jan Mercl <0xj...@gmail.com> wrote: > On Mon, Jul 24, 2023 at 9:14 AM David N wrote: > > On Linux you may try fiddling with ip

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread David N
ite a sample program on play.golang.org, > which does roughly want you want except for pause/resume, and post a link > here and we can modify it for pause/resume. > > On Jul 21, 2023, at 10:47 PM, David N wrote: > > I've posted this question on stackoverflow > <ht

Re: [go-nuts] no way to pause `Listen` on net connections

2023-07-24 Thread David N
simply > accept the connection request then close the connection (or do whatever > else makes sense). I read your StackOverflow question and am still > perplexed what problem you are trying to solve. > > On Sun, Jul 23, 2023 at 10:11 PM David N wrote: > >> I've posted

[go-nuts] no way to pause `Listen` on net connections

2023-07-23 Thread David N
I've posted this question on stackoverflow , discussed it with some members of the golang community, and I was encouraged to post here. Problem: I have a secure application and I want

Re: [go-nuts] Redfining loop variable semantics - what's the plan?

2023-04-10 Thread David Finkel
On Mon, Apr 10, 2023 at 7:23 PM xi ool wrote: > Little late but I have to say the rational seems foolish : > > >1. Currently 25% of gophers who didn't read the language spec >experienced a 'bug' and got unexpected behavior.. > > This premise is a bit suspect. The current loop-variable be

[go-nuts] building go 1.20.1 to C for use in Nodejs

2023-02-23 Thread David Choi (jsoneaday)
Hi I'm trying to build my project as C so I can call it from Nodejs. But when I run the command "go build -buildmode=c-shared -o keyring.so ." I get a so file but no h C header. I am running this on Mac M1. I read something about cgo being disabled by default on mac's without the c toolchain bu

Re: [go-nuts] Why is runtime.Gosched needed in this single-threaded, no-goroutines cgo program?

2023-02-16 Thread David Finkel
On Wed, Feb 15, 2023 at 4:05 PM Ian Lance Taylor wrote: > On Wed, Feb 15, 2023 at 8:42 AM 'Marko Bencun' via golang-nuts > wrote: > > > > I am running into a a weird error in C code that only materializes > > when calling it from Go using cgo. I hope you could help me understand > > this behavio

Re: [go-nuts] Why can't a regexp.Regexp be const

2023-02-13 Thread David Finkel
On Mon, Feb 13, 2023 at 6:48 PM Pat Farrell wrote: > This won't compile > > var ExtRegex = > regexp.MustCompile("(M|m)(p|P)(3|4))|((F|f)(L|l)(A|a)(C|c))$") > > with a > ./prog.go:10:18: > regexp.MustCompile("((M|m)(p|P)(3|4))|((F|f)(L|l)(A|a)(C|c))$") (value of > type *regexp.Regexp) is not const

[go-nuts] Re: CBOR / pq cryptography migration / software architecture golang question

2023-02-10 Thread David Stainton
this where a Sphinx Geometry object is an argument to the method which does the unmarshaling; and using that Sphinx Geometry to determine which concrete cryptographic key type should be used. On Friday, February 10, 2023 at 6:19:55 PM UTC-5 David Stainton wrote: > > Greetings people of

[go-nuts] CBOR / pq cryptography migration / software architecture golang question

2023-02-10 Thread David Stainton
works because the nil value of KeyValue struct will have a nil for it's Value field. Any suggestions? Cheers, David -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, se

Re: [go-nuts] Silly question about parentheses

2023-02-01 Thread David Finkel
On Wed, Feb 1, 2023 at 11:22 AM Chris Burkert wrote: > Looking into the spec: > > https://go.dev/ref/spec#Return_statements > ReturnStmt = "return" [ ExpressionList ] . > ExpressionList = Expression { "," Expression } . > ... no () here > > https://go.dev/ref/spec#Function_types > FunctionType

Re: [go-nuts] Clarification of memory model behavior within a single goroutine

2023-01-22 Thread &#x27;David Klempner' via golang-nuts
On Mon, Jan 23, 2023 at 11:38 AM Robert Engels wrote: > The atomic functions force a memory barrier when atomically in conjunction > with the atomic read of the same value. > > You could use CGO to call a C function to do what you desire - but it > shouldn’t be necessary. > C doesn't solve this

[go-nuts] the example always fails if the string contains a trailing space before a newline

2022-12-19 Thread David M
Not quite sure if this is a bug but it's annoying: If the example tested string contains a trailing space before a newline, the test always fails no matter how. // this test passes func ExampleFormat() { fmt.Println("a\nb") // Output: // a // b } // this test fails no matter we

Re: [go-nuts] cgo C.uint64_t compatiblity on multiple platforms?

2022-12-03 Thread David Stainton
Thanks, yes switching those type casts to C.size_t worked. On Saturday, December 3, 2022 at 2:39:24 PM UTC-5 kortschak wrote: > On Sat, 2022-12-03 at 10:51 -0800, David Stainton wrote: > > Greetings, > > > > I think my question is something like: "how to make my usage

[go-nuts] cgo C.uint64_t compatiblity on multiple platforms?

2022-12-03 Thread David Stainton
I "fixed" it by changing the typecast to use C.uint64_t instead of C.ulong: https://github.com/katzenpost/katzenpost/pull/110/files However that causes the build to fail using Go1.19.3 on MacOS, although it works on Windows: https://github.com/katzenpost/katzen/actions/runs/3609771045

Re: [go-nuts] Re: Go implementation of CLP

2022-11-19 Thread david lion
with the terminology. I thought the search > through compressed logs was the most interesting part. Is that included in > the "parsing component"? > > On Fri, Nov 18, 2022 at 1:21 PM david lion wrote: > >> At the moment we're working on a Go binding around the

Re: [go-nuts] Re: Go implementation of CLP

2022-11-18 Thread david lion
gt; >> I'm exploring CLP for a logging platform and I think either a cgo or >> native go library might be something that would help us. >> >> On Tuesday, 4 October 2022 at 22:03:34 UTC+5:30 david...@gmail.com wrote: >> >>> It would be awesome to help SeaweedFS

[go-nuts] Re: checkptr reports error in lfstack_64bit.go

2022-11-10 Thread David Pacheco
; Maybe the lfstack routines need a go:nocheckptr annotation? >>> >>> On Tuesday, November 8, 2022 at 11:21:30 AM UTC-8 David Pacheco wrote: >>> >>>> Hello, >>>> >>>> I’m trying to track down an issue reported by the Go memory allocato

Re: [go-nuts] Underscore symbol

2022-11-05 Thread David Finkel
On Sat, Nov 5, 2022 at 4:57 AM Chris Burkert wrote: > I am curious: from a compiler perspective, does that mean that by using _ > simply less assembler instructions are created by not handling those > registers which relate to _? > > That kind of depends on what you mean by "not handling". Since

Re: [go-nuts] Analyse postgresql error

2022-10-27 Thread David Harel
Thanks. Exactly what I needed. On Wed, Oct 26, 2022 at 3:45 PM Konstantin Khomoutov wrote: > On Wed, Oct 26, 2022 at 01:38:51PM +0300, David Harel wrote: > > [...] > > func errorCheckResult(err error) string { > > if err == nil { > > return "

Re: [go-nuts] Any information about adding a trailing comma in ast CompositeLit (for structs)

2022-10-26 Thread David Finkel
s appropriate and match the formatting of the struct definition. (AFAICT) > > reference code: > https://github.com/tjgurwara99/constr/blob/0e0f8952c652b7a7a10b7238daed90132b924084/construct.go#L31 > > On Tuesday, 25 October 2022 at 01:07:23 UTC+1 david@gmail.com wrote: > &g

Re: [go-nuts] Analyse postgresql error

2022-10-26 Thread David Harel
plicate key value violates unique constraint "treatment_pk" {"Severity":"ERROR","Code":"23505","Message":".MoreStuff."}`) mockDB.EXPECT().AppointmentUpdate(gomock.Any(), gomock.Any()).Return(err) Any idea? On Tue,

Re: [go-nuts] Any information about adding a trailing comma in ast CompositeLit (for structs)

2022-10-24 Thread David Finkel
On Sat, Oct 22, 2022 at 10:00 PM Tajmeet Singh wrote: > Hello, > > I've been working on a utility to generate constructors for me when I > provide it with a path to the file containing the struct and it `Ident`. > The idea was that I would just create a ast.Node (FuncDecl) with all the > necessar

[go-nuts] Analyse postgresql error

2022-10-21 Thread David Harel
Hi there, Newbie on golang. Using sqlc: https://github.com/kyleconroy/sqlc in the environment created by Karl Keefer: https://github.com/karlkeefer/pngr/actions/workflows/build.yml, thanks Karl. My queries use querier which is auto generated by sqlc. Sometime I get an error result in my query s

[go-nuts] Re: cgo: how to pass an entropy source from golang to C?

2022-10-19 Thread David Stainton
On Tuesday, October 18, 2022 at 9:50:21 PM UTC-4 David Stainton wrote: > > Okay here I've tried a similar solution to the go-pointers library... but > i had to change it a bit to fit how the C library uses the context pointer: > > https://git.xx.network/e

[go-nuts] Re: cgo: how to pass an entropy source from golang to C?

2022-10-18 Thread David Stainton
uot;rng is nil"... not sure why. So I'm going to try another solution where I change the C api slightly. I'm convinced there are many possible solutions to this and picking one is a matter of deciding among a few tradeoffs. On Tuesday, October 18, 2022 at 6:33:11 PM UTC-4 David Sta

[go-nuts] cgo: how to pass an entropy source from golang to C?

2022-10-18 Thread David Stainton
Greetings cgo experts, perhaps this post might also be of some interest to cryptography people as well. What's the best way for a C cryptography library to receive entropy from golang? There exists a C cryptography library (CTIDH, it's a PQ NIKE)... I am collaborating with C programmers who ar

Re: [go-nuts] Re: Go implementation of CLP

2022-10-04 Thread david lion
a library with programmatic API be favourable for integration rather than calling out to another tool/executable (as required in CLP's current form)? Would a go package using cgo (to reuse some existing cpp code) be desirable or is there a requirement for strictly go code? -david On Sunday, 2 Octo

[go-nuts] Re: Go implementation of CLP

2022-10-02 Thread david lion
re-write in Go? -david On Friday, 30 September 2022 at 03:58:44 UTC-4 ChrisLu wrote: > Seems there are no Go implementation for Compressed Log Processor (CLP) > yet? > > CLP is a tool capable of losslessly compressing text logs and searching > the compressed logs wi

Re: [go-nuts] google code style is the same as gofmt in go codes?

2022-09-13 Thread David Finkel
On Tue, Sep 13, 2022 at 5:39 PM Axel Wagner wrote: > > > On Tue, Sep 13, 2022 at 10:46 PM David Finkel > wrote: > >> On Tue, Sep 13, 2022 at 3:55 PM Moein Halvaei >> wrote: >> >>> When I read codes from https://cs.opensource.google/go, indents are 2 &

Re: [go-nuts] google code style is the same as gofmt in go codes?

2022-09-13 Thread David Finkel
On Tue, Sep 13, 2022 at 3:55 PM Moein Halvaei wrote: > When I read codes from https://cs.opensource.google/go, indents are 2 > spaces and when using gofmt indents are 2 tabs. Why? > Google's Codesearch defaults to matching Google's C++ style guide rather than Go's recommended style: https://googl

Re: [go-nuts] Any package implementing FIFO mutex?

2022-09-09 Thread David Finkel
Not a drop-in replacement, but there is net/textproto.Pipeline . (intended for sequencing text-based network protocols going over a socket, but it's not too far off) You'd call `Next()` to grab the sequence-handle and then call `p.StartRequest(id)` to gra

Re: [go-nuts] cgo binding copies data twice, necessary?

2022-08-23 Thread David Stainton
Hi! Yes that works perfectly. I've added the bounds checking. Thanks and cheers! Sincerely, David On Tuesday, August 23, 2022 at 3:51:39 AM UTC-4 progl...@gmail.com wrote: > Assuming that `p.privateKey = *((*C.private_key)(key))` is making a full > copy, not shallow. I think you

[go-nuts] cgo binding copies data twice, necessary?

2022-08-22 Thread David Stainton
e_key)(key)) } https://git.xx.network/elixxir/ctidh_cgo/-/blob/master/binding.go#L49-54 Sincerely, David -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an e

Re: [go-nuts] Type switch on generic parameter

2022-08-11 Thread David Finkel
On Thu, Aug 11, 2022 at 7:40 PM 'Matt Rosencrantz' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I'd really love to be able to do: > > type allowedTypes{ > int64|float64|string > } > > func Foo[T allowedTypes](arg T) { > switch t := arg { >case int64: >// somet

[go-nuts] Triggering go:generate via go build/install?

2022-08-08 Thread &#x27;David Vennik' via golang-nuts
One of the big advantages of many other build systems and for which reason many Go projects use Makefiles is that running generators is not automated. As I see it, the only thing required to make it automatic is annotation to make note of the sources that generators build off and trigger rerunni

Re: [go-nuts] GO program's memory footprint is confusing

2022-05-09 Thread David Finkel
Looking at proc-10451, I see that there are two mappings with anonymous huge pages in that smaps output, and none on the other. Does one machine have transparent hugepages enabled, and the other not? You can check whether they're enabled on that system by looking at /sys/kernel/mm/transparent_hugep

Re: [go-nuts] Add comparisons to all types

2022-05-05 Thread David Arroyo
gions, so that the receive operation in the above example actually received a duplicate copy of a function? I will admit that closures with mutable data segments already complicate such an optimization, but function equality would thwart such an optimization altogether. David -- You received thi

Re: [go-nuts] Advice for closed network - problem with go mod

2022-04-25 Thread David Arsenault
cache/download > > - sean > > > On Mon, Apr 25, 2022 at 10:08 PM David Arsenault > wrote: > >> Hello. I was hoping to get some smart advice on a problem using go on a >> closed network. >> >> Summary: >> - closed network, no outside ac

[go-nuts] Advice for closed network - problem with go mod

2022-04-25 Thread David Arsenault
tall is somehow broken? I suppose I could vendor everything but it would be better if the tool would find the packages already copied to the closed network. Pulling my hair out. Thanks in advance for your advice Gophers! David -- You received this message because you are subscribed to th

Re: [go-nuts] Re: New edition of the Go Programming Language comming soon ?

2022-03-15 Thread David Karr
There is nothing new here. Every programming language, framework, and tool has had the same problem. Quality documentation and training is often the hardest thing to produce, and is often deemphasized in budgets. It's also part of the last 10% of doing something that usually takes 90% of the time

[go-nuts] BPF target

2022-02-24 Thread &#x27;David Vennik' via golang-nuts
With the Solana project running with the old and perfectly adequate BPF bytecode and execution engines already inside the linux kernel, it seems that this might be a good target to add to Go's existing targets. I mean, yes, I am aware of the severe limitations, no loops, etc, but to be able to

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 w

[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 extr

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

2022-02-23 Thread David Finkel
u use t.TempDir <https://pkg.go.dev/testing#T.TempDir> to create the tempdir. :) > > On Wednesday, 23 February 2022 at 16:30:06 UTC+1 david@gmail.com > wrote: > >> On Wed, Feb 23, 2022 at 8:53 AM Leam Hall wrote: >> >>> My program uses data and template fil

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 crea

[go-nuts] Getting "$GOPATH/go.mod exists but should not" when running build in a Docker image

2022-02-11 Thread David Karr
I had earlier written a note about troubles refactoring my project to have a "src" directory, but I've backed off on that for now. I see that the main problem I saw with that hasn't changed when backing out those changes. It appears that running this build inside a docker image seems to be som

[go-nuts] Having trouble getting app to build with Docker after moving to a "src" directory

2022-02-10 Thread David Karr
I had a small go application building successfully. I had the go.mod and main.go in the root directory of the project, and I was building it pretty easily with a Makefile, which just did the following: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o target/dist/linux-amd64 I decided I w

[go-nuts] What exactly can be supplied as "packages" on the go build command line?

2022-02-10 Thread David Karr
When I enter "go help build", the first few lines shows this: usage: go build [-o output] [build flags] [packages] Build compiles the packages named by the import paths, The instructions say very little about what can be supplied as "packages". It says it can be a list of .go files, and app

Re: [go-nuts] Re: Why, oh why, do people do this? Things that annoy me in Go code.

2022-01-29 Thread David Finkel
On Sat, Jan 29, 2022 at 6:21 AM Tim Hardcastle wrote: > Agree with Rudolf on point 2. Long meaningful variable/function names are > good. Comments become obsolete, they become detached from their code, > they're only used to explain the name of the variable once and then you're > left with someth

Re: [go-nuts] Looping and tail-end code

2022-01-12 Thread David Finkel
On Wed, Jan 12, 2022 at 5:02 AM Tobias Klausmann wrote > So what is the *idiomatic* way of being able to use `continue` (or > something like it), yet have "always do this" code at the end of the > loop? As I understand it, `defer` only works for ends of functions, not > ends of blocks, and label

Re: [go-nuts] Re: Alternatives to wrapping errors

2022-01-01 Thread David Finkel
On Fri, Dec 31, 2021 at 5:12 AM Brian Candler wrote: > On Friday, 31 December 2021 at 08:10:49 UTC Henry wrote: > >> The purpose of error wrapping is to give contextual information about the >> error. It is supposed to help you understand and locate the error. For >> instance, *"invalid filename"

Re: [go-nuts] grpc and golang struct tags

2021-11-30 Thread David Finkel
On Sat, Nov 27, 2021 at 10:53 AM Sankar wrote: > Hi > > I have a database that has a column `2xxCode`. This database is part of a > legacy system and I cannot make changes to this, as there are multiple > applications that depend on this, and some of the applications are > unchangeable. > > Now I

Re: [go-nuts] How to vary cgo lib path by os?

2021-11-27 Thread David Karr
On Saturday, November 27, 2021 at 1:13:12 PM UTC-8 David Karr wrote: > On Sat, Nov 27, 2021 at 11:57 AM Ian Lance Taylor > wrote: > >> On Sat, Nov 27, 2021 at 11:01 AM David Karr >> wrote: >> > >> > I'm aware of the "build constraints&qu

Re: [go-nuts] How to vary cgo lib path by os?

2021-11-27 Thread David Karr
On Sat, Nov 27, 2021 at 11:57 AM Ian Lance Taylor wrote: > On Sat, Nov 27, 2021 at 11:01 AM David Karr > wrote: > > > > I'm aware of the "build constraints" mechanism, which lets individual > files be only compiled on specific oses or architectures. > &g

[go-nuts] How to vary cgo lib path by os?

2021-11-27 Thread David Karr
I'm aware of the "build constraints" mechanism, which lets individual files be only compiled on specific oses or architectures. I am constructing an app that has a single cgo module, which is the "meat" of the application (longest module). In my poc, the cgo header specifies a lib path with "li

Re: [go-nuts] some incorrect code in blog.

2021-11-25 Thread David Karr
;%v\n", f) > if err != nil { > fmt.Println("NO FILE") > //return >} >defer f.Close() >fmt.Println("END") > } > > > Am Do., 25. Nov. 2021 um 21:43 Uhr schrieb David Karr < > davidmichaelk...@gmail.com&

Re: [go-nuts] some incorrect code in blog.

2021-11-25 Thread David Karr
And did you test that with a file path that would fail? On Thu, Nov 25, 2021, 11:40 Roland Müller wrote: > Hello, > > actually trying this with os.Open() the program behaves the same > regardless whether the defer is before or after the error handling, Thus, > no panic :-) > > Isn't anything dec

Re: [go-nuts] some incorrect code in blog.

2021-11-24 Thread David Karr
On Wed, Nov 24, 2021 at 6:14 PM Fannie Zhang wrote: > Hi all, > > There is some incorrect code in > https://go.dev/blog/defer-panic-and-recover blog. > > The original code is > *func CopyFile() {* > * ...* > * if err != nil {* > * return* > * }* > * defer src.Close()* > * ...* > *}

[go-nuts] Re: Getting "cgo argument has Go pointer to Go pointer"

2021-11-15 Thread David Karr
On Monday, November 15, 2021 at 3:49:20 PM UTC-8 David Karr wrote: > > I'm pretty new to Go (many years in other languages). I'm trying to use > cgo to use a C library we're using. > > I have the following line of code, which is compiling (that's been enough

[go-nuts] Getting "cgo argument has Go pointer to Go pointer"

2021-11-15 Thread David Karr
I'm pretty new to Go (many years in other languages). I'm trying to use cgo to use a C library we're using. I have the following line of code, which is compiling (that's been enough of a struggle): status = int(C.VeProtect(C.VeObj(fpeProtect), &argsProtect)) This is failing at runtime with

Re: [go-nuts] Which error handling pattern do you prefer?

2021-11-12 Thread David Finkel
On Fri, Nov 12, 2021 at 7:48 AM Miguel Angel Rivera Notararigo < ntr...@gmail.com> wrote: > I tend to use errX (X is adapted according to context) for function scoped > errors, and err for block scoped errors > > func MyFunc() error { >> v, errDS := doSomething() >> ... >> errDA := doAnother

Re: [go-nuts] HPC image processing in go?

2021-11-04 Thread David Finkel
On Thu, Nov 4, 2021 at 5:43 AM quin...@gmail.com wrote: > Hi, > > Has anyone got any experience of high performance image processing in go? > > By this I mean doing complex image processing in real time at 4K > resolution on commodity hardware. This is really pushing it using carefully > written

Re: [go-nuts] Re: Why go plugin addresses do not load with go binary #49225

2021-11-01 Thread David Finkel
On Mon, Nov 1, 2021 at 9:44 AM Manoj Chauhan wrote: > Hi Brian, > > greeter.go calls plugin.open and it will be work only for one sub version > of go. If plugin and binary are made in different sub versions of go1.15 > then plugin.open will not work. > It sounds like you want to ignore a major wa

Re: [go-nuts] ast.NewPackage errors for built in types

2021-10-11 Thread David Finkel
On Mon, Oct 11, 2021 at 5:48 AM Steven Hartland wrote: > If the ast.Files passed to ast.NewPackage includes built in types such as > int it returns an error e.g. > file1.go:5:6: undeclared name: int > > Is there a way to prevent that? > Generally, I always add the `builtin` package to the list o

Re: [go-nuts] Draining http response bodies

2021-10-08 Thread David Riley
On Oct 7, 2021, at 3:36 AM, Amnon wrote: > > Is it necessary for a http client to fully read the http response body? > > Opinion on the Go forums seems divided > https://forum.golangbridge.org/t/do-i-need-to-read-the-body-before-close-it/5594 > > But a simple benchmark https://play.golang.org/

[go-nuts] Re: What is up with memo.com?

2021-09-22 Thread David Taylor
I've just been made aware of this, and we're looking into getting it fixed. I apologize for the unwanted emails — it should not be happening. Would anyone care to forward me what we're sending you if you have the chance? Dave On Tuesday, September 21, 2021 at 1:19:06 PM UTC-7 Brian Candler wr

Re: [go-nuts] Idea extending xerror.As

2021-09-21 Thread David Finkel
it through with one use-case like this since the bar for language changes is so much higher than standard library changes. (for good reason) On Sunday, September 19, 2021 at 3:43:36 PM UTC-6 david@gmail.com wrote: > >> On Sun, Sep 19, 2021 at 5:19 PM roger peppe wrote: >>

Re: [go-nuts] Idea extending xerror.As

2021-09-19 Thread David Finkel
ot;errno %[1]d: %[1]s", en) } ``` Since it looks like the dev.typeparams branch has been merged into master, I was just thinking about how we'd add the two-return-value/generic version of As to the errors package (for go 1.18). Given that the original proposal's code works pret

Re: [go-nuts] Idea extending xerror.As

2021-09-19 Thread David Finkel
On Sun, Sep 19, 2021 at 4:02 PM David Finkel wrote: > You might be interested in the original draft proposal for errors.As: > > https://go.googlesource.com/proposal/+/master/design/go2draft-error-inspection.md#the-is-and-as-functions > > In particular, it originally specified

Re: [go-nuts] Idea extending xerror.As

2021-09-19 Thread David Finkel
You might be interested in the original draft proposal for errors.As: https://go.googlesource.com/proposal/+/master/design/go2draft-error-inspection.md#the-is-and-as-functions In particular, it originally specified that errors.As would take a type-parameter. (the version of generics that was propo

[go-nuts] Right way to fan out work loads

2021-09-08 Thread David Belle-Isle
utines and (B) can run into a bottle neck. Each of these problems can be easily addressed. I'm more interested in hearing what you think is the "right" way to solve this problem? Thanks David -- You received this message because you are subscribed to the Google Groups "

Re: [go-nuts] Re: WASM Performance

2021-09-07 Thread David Suarez
e browser) so needed to ensure it was never blocked/ responded quickly.  When you read through you may find your answer or something that gives you an idea to start searching through in your code.   Hope it helps, David -- You received this me

Re: [go-nuts] Re: WASM Performance

2021-09-07 Thread David Suarez
b3e-f811e61c01ben%40googlegroups.com. Sincerely, David Suarez Gallup Strengths Finder:  Achiever * Strategic * Relator * Ideation * Learner https://www.linkedin.com/in/davidjsuarez/  -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: Makefiles for Go Programs

2021-08-23 Thread David Riley
On Aug 23, 2021, at 12:48, Roland Müller wrote: > > What are the alternatives to Makefile that are used by Go developers? Please > comment :-) Well, there’s mage, which aims to more or less replace the functionality of Make for Go. I’m not really sold on *needing* a replacement for Make, and i

Re: [go-nuts] Makefiles for Go Programs

2021-08-23 Thread David Riley
On Aug 22, 2021, at 23:11, jlfo...@berkeley.edu wrote: > >  > I've noticed that few, if any, Go programs use Makefiles. Is that because the > overhead of using make is greater than the overhead of just always compiling > and linking everything? > One piece of evidence for this is that the Go c

Re: [go-nuts] Why isn't go more popular?

2021-08-06 Thread David Riley
On Aug 5, 2021, at 10:27 PM, Ian Lance Taylor wrote: > > On Thu, Aug 5, 2021 at 7:20 PM Santi Ferra > wrote: >> >> When you see the ranking of the most liked programming languages, go is near >> c++, a really "hated app". But since is efficient and produces really clean >> code, why no wants

Re: [go-nuts] Changing wall clock in unit test

2021-07-30 Thread David Finkel
On Fri, Jul 30, 2021 at 12:13 AM Carl wrote: > Hi, > > Is there a way to write a unit test that simulates a change in the wall > clock for a time.Time value? > I use a combination of two approaches to simulate the passage of time (often both work together): - have functions a `now` argument

Re: [go-nuts] Go and GPUs

2021-06-25 Thread David Riley
On Jun 25, 2021, at 10:23 PM, Robert Engels wrote: > > There is also a LOT of support for Java and CUDA/OpenCL. You can essentially > reimplement them Java portion in Go. There are multiple open source projects > in this area. > > Might be a lot easier than starting from scratch. Yes, CGo i

Re: [go-nuts] Go and GPUs

2021-06-25 Thread David Riley
On Jun 25, 2021, at 1:32 PM, Robert Engels wrote: > > Why not develop a Go <> CUDA binding using CGo? This (ditto for OpenCL, Vulkan, etc) is more likely the path you'll have to go down. Generally all of these interfaces rely on pretty massive libraries from NVIDIA, AMD, Intel, etc. which are

Re: [go-nuts] Recomended GOPROXY (or not) for Open Source projects?

2021-06-25 Thread David Finkel
On Fri, Jun 25, 2021 at 1:23 PM josvazg wrote: > When working on internal company projects, it makes sense to use a company > wide GO Proxy assuring that all go dependency code is available and > immutable. But when you move to an Open Source project, you cannot longer > use such private proxy. >

Re: [go-nuts] Golang language specification Document: Composite Literals example is not understandable

2021-06-22 Thread David Riley
On Jun 22, 2021, at 12:42, Axel Wagner wrote: > >  > Oh and also: > >> Likewise, I think this only works for array literals; I don’t think (though >> again have not tried it) that you can declare slice literals with only >> selected members initialized. > > Works fine too: https://play.golan

Re: [go-nuts] Golang language specification Document: Composite Literals example is not understandable

2021-06-22 Thread David Riley
On Jun 22, 2021, at 11:39, Vaibhav Maurya wrote: > > Hi, > > Please help me to understand the following syntax mentioned in the Golang > language specification document. > > https://golang.org/ref/spec#Composite_literals > > following is the search string for CTRL + F > // vowels[ch] is true

  1   2   3   4   5   6   >