[go-nuts] Re: How to add labels to Go runtime prometheus metrics?

2024-03-06 Thread cpu...@gmail.com
Situation here may be a bit specific. Running 2 cloud machines behind reverse proxy. I realise this is per chance if the proxy will hit any of the two, but that would be good enough id I could distinguish their metrics. On Wednesday, March 6, 2024 at 1:38:12 PM UTC+1 Brian Candler wrote: > The

Re: [go-nuts] Query Regarding ASAN C Call from Go Code

2024-03-06 Thread Evgeny Chormonov
I encountered an issue when trying to use pragma *//go:cgo_export_static *in my Go code similar to the *ASAN* code. https://github.com/golang/go/blob/f0d1195e13e06acdf8999188decc63306f9903f5/src/runtime/asan.go#L65 It seems there is a check in the compile utility preventing this.

[go-nuts] Re: Why Go opt for using * in signature of function that returns a pointer instead of using &?

2024-03-06 Thread peterGo
Matheus, Rewire your brain. The return value or values may be explicitly listed in the "return" statement. Each expression must be single-valued and assignable to the corresponding element of the function's result type. The Go Programming Language Specification

Re: [go-nuts] Why Go opt for using * in signature of function that returns a pointer instead of using &?

2024-03-06 Thread Matheus Fassis Corocher
Thank for your answers, makes a lot of sense. Em quarta-feira, 6 de março de 2024 às 02:24:50 UTC-3, Kurtis Rader escreveu: > Anyone familiar with C/C++ will be familiar with the current convention of > using an asterisk to indicate a pointer to the value. Yes, there is a > reasonable

[go-nuts] Re: How to add labels to Go runtime prometheus metrics?

2024-03-06 Thread 'Brian Candler' via golang-nuts
The server name will be added by Prometheus itself as an "instance" label for each target being scraped (or you can manually set the instance label for each target), so in general what you're asking is not necessary. None of the standard Prometheus exporters include a label for the hostname

[go-nuts] How to add labels to Go runtime prometheus metrics?

2024-03-06 Thread cpu...@gmail.com
The Go runtime exposes various metrics. To collect metrics from multiple servers I'd like to add labels for server name. Is it possible to extend the build-in metrics for this purpose? Thanks, Andi -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Why Go opt for using * in signature of function that returns a pointer instead of using &?

2024-03-05 Thread Kurtis Rader
Anyone familiar with C/C++ will be familiar with the current convention of using an asterisk to indicate a pointer to the value. Yes, there is a reasonable argument for using an ampersand but either syntax is essentially arbitrary; thus a coin flip as to which to use. So we might as well use the C

Re: [go-nuts] Why Go opt for using * in signature of function that returns a pointer instead of using &?

2024-03-05 Thread Ian Lance Taylor
On Tue, Mar 5, 2024, 8:33 PM Matheus Fassis Corocher < matheuscoroc...@gmail.com> wrote: > I was studying about pointers and struct in Golang and one thing that I > don't understand is why using * in return of signature of function instead > of & if the return of function is an address of

[go-nuts] Why Go opt for using * in signature of function that returns a pointer instead of using &?

2024-03-05 Thread Matheus Fassis Corocher
I was studying about pointers and struct in Golang and one thing that I don't understand is why using * in return of signature of function instead of & if the return of function is an address of variable? The correct version that works: func NewVertex(X, Y int) **Vertex* { ... return {X,

Re: [go-nuts] Loop unit char entered

2024-03-05 Thread Michael Adamus
Daniel, I'd like to see source code for this if you're able. Thanks, Mike On Saturday, April 16, 2022 at 6:21:30 AM UTC-4 Daniel Jankins wrote: > Thank you, > That is what I did. It works very well. > Thank you again > > On Fri, Apr 15, 2022 at 8:48 PM Kurtis Rader wrote: > >> On Fri, Apr 15,

[go-nuts] [security] Go 1.22.1 and Go 1.21.8 are released

2024-03-05 Thread announce
Hello gophers, We have just released Go versions 1.22.1 and 1.21.8, minor point releases. These minor releases include 5 security fixes following the security policy : - crypto/x509: Verify panics on certificates with an unknown public key algorithm

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-05 Thread 'Bryan C. Mills' via golang-nuts
On Mon, Mar 4, 2024 at 8:52 PM Jeffery Carr wrote: > On Monday, March 4, 2024 at 8:44:14 AM UTC-6 Bryan C. Mills wrote: > > Per https://go.dev/doc/go1.22#go-command: > > go get is no longer supported outside of a module in the legacy GOPATH mode > (that is, with GO111MODULE=off). Other build

[go-nuts] Re: c-shared library for Aix

2024-03-05 Thread Anshuman Mor
I tried with clang also but not luck, tried different approaches like using gccgo to directly build c-shared vs building c-archive using golang and then converting it to c-shared by linking using gcc/clang. No luck at all. On Sunday 3 March 2024 at 20:29:12 UTC+5:30 TheDiveO wrote: >

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-04 Thread Jeffery Carr
On Monday, March 4, 2024 at 8:44:14 AM UTC-6 Bryan C. Mills wrote: Per https://go.dev/doc/go1.22#go-command: > go get is no longer supported outside of a module in the legacy GOPATH mode (that is, with GO111MODULE=off). Other build commands, such as go build and go test, will continue to work

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Mike Schinkel
> On Mar 4, 2024, at 5:14 PM, Ian Lance Taylor wrote: >> P.S. Seems to me that #4 might be the simplest way forward as it would allow >> for creation of types that cannot be represented as their literal subtype >> value to pass as a parameter to a `func`, and it would not require any new >>

Re: [go-nuts] text template range over Rangefunc

2024-03-04 Thread Ajay Kidave
Sure, created a proposal at https://github.com/golang/go/issues/66107 Ajay On Monday, March 4, 2024 at 2:11:59 PM UTC-8 Ian Lance Taylor wrote: > On Mon, Mar 4, 2024 at 11:47 AM Ajay Kidave wrote: > > > > The https://go.dev/wiki/RangefuncExperiment change will be a great > addition to the

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Ian Lance Taylor
On Mon, Mar 4, 2024 at 11:32 AM Mike Schinkel wrote: > ... > 4. Relax the allowable values that can be assigned to a `const` to include > values that can be fully determined at compile time such as `const April = > [1]byte{4}` thus allowing `const` and > types of subtypes `struct`, `map`,

Re: [go-nuts] text template range over Rangefunc

2024-03-04 Thread Ian Lance Taylor
On Mon, Mar 4, 2024 at 11:47 AM Ajay Kidave wrote: > > The https://go.dev/wiki/RangefuncExperiment change will be a great addition > to the language. I wanted to know whether the text/html template std > libraries will allow range over rangefunc. Currently, the doc for > text/template says > >

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-04 Thread Jeff Stein
And looking through the source code on os.exec_linux I think I've also validated this as well: if fd[i] == i { // dup2(i, i) won't clear close-on-exec flag on Linux, // probably not elsewhere either. _, _, err1 = RawSyscall(fcntl64Syscall, uintptr(fd[i]), F_SETFD, 0) if err1 != 0 { goto

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-04 Thread Jeff Stein
It appears this was in fact the issue. I added some code to print out the `FD_CLOEXEC` state. Files called via *syscall.Dupe2* end up with a *FD_CLOEXEC=0* whereas anything passed via *ExtraFiles* has a *FDCLOEXEC=1.* Whoever said "This is impossible" thanks - you spurred me towards a

[go-nuts] text template range over Rangefunc

2024-03-04 Thread Ajay Kidave
The https://go.dev/wiki/RangefuncExperiment change will be a great addition to the language. I wanted to know whether the text/html template std libraries will allow range over rangefunc. Currently, the doc for text/template

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Mike Schinkel
> On Mar 4, 2024, at 12:18 PM, Jeremy French wrote: > > More, to prevent PrintMonth(14) which the function would have to check for > and either return an error or panic, since there is no meaningful output. ... > I was more just answering Mike Schinkel's question about why it would be >

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-04 Thread Jeff Stein
I think I may have discovered the issue. I made a sys call to duplicate the file descriptor dupFd, err := syscall.Dup(int(file.Fd())) if err != nil { log.Printf("Error duplicating file descriptor: %v", err) return 0, "" } which likely reset the FD_CLOEXEC Flag: (from Advanced Programming in

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Nicolas Serna
I think what Jeremy mentions in here is the key to the issue. There would be more consensus and less interest in "fixing" enums in Go if there was a tangible way to restrict their values to what is stated by the developer. El lunes, 4 de marzo de 2024 a la(s) 12:18:05 p.m. UTC-3, Jeremy French

Re: [go-nuts] Query Regarding ASAN C Call from Go Code

2024-03-04 Thread Ian Lance Taylor
On Mon, Mar 4, 2024 at 9:55 AM Evgeny Chormonov wrote: > > I'm using Linux as my platform, but I'm curious why this solution is > restricted to Linux systems only? > https://github.com/golang/go/blob/master/src/runtime/asan/asan.go#L5 That's just the list of systems for which we support asan.

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Ian Lance Taylor
On Mon, Mar 4, 2024 at 9:40 AM Jan Mercl <0xj...@gmail.com> wrote: > > The static type of an interface can be verified at compile time. The > value of a variable of an enum type (or a Pascal-like subrange) type, > cannot be verified at compile time in the general case. You would have > to add

Re: [go-nuts] Query Regarding ASAN C Call from Go Code

2024-03-04 Thread Evgeny Chormonov
Thanks for your answer, Ian. I've decided to use a code generator based on cgo instead of writing assembly code for each function. I'm using Linux as my platform, but I'm curious why this solution is restricted to Linux systems only?

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jan Mercl
On Mon, Mar 4, 2024 at 6:19 PM Jeremy French wrote: > More, to prevent PrintMonth(14), which the function would have to check for > and either return an error or panic, since there is no meaningful output. In > fact, it's fairly easy to see, even in this case, where the PrintMonth >

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jeremy French
More, to prevent PrintMonth(14), which the function would have to check for and either return an error or panic, since there is no meaningful output. In fact, it's fairly easy to see, even in this case, where the PrintMonth signature would have to return an error, when that is pretty much the

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-04 Thread Jeff Stein
OP here -> I'm going to put together some test apps - toss them on GitHub and make sure I actually know what I'm talking about :) On Friday, March 1, 2024 at 7:57:15 PM UTC-7 Ian Lance Taylor wrote: > On Fri, Mar 1, 2024 at 6:17 PM Robert Engels wrote: > > > > The could be calling fork() as

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread 'Brian Candler' via golang-nuts
On Monday 4 March 2024 at 15:18:05 UTC Jeremy French wrote: What I find valuable is to be able to accept an enum as a parameter to a function, and know that it will be one of several approved values (e.g. month of the year) ISTM all that's needed is to have a way to create a named type which

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jan Mercl
On Mon, Mar 4, 2024 at 4:19 PM Jeremy French wrote: > It's checked at compile-time rather than run time. That requires immutability of variables of enum type. Go does not support immutable variables. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jeremy French
What I find valuable is to be able to accept an enum as a parameter to a function, and know that it will be one of several approved values (e.g. month of the year), without having to have boiler plate to check or throw errors if it's not one of the approved values. It's checked at

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-04 Thread 'Bryan C. Mills' via golang-nuts
Per https://go.dev/doc/go1.22#go-command: > go get is no longer supported outside of a module in the legacy GOPATH mode (that is, with GO111MODULE=off). Other build commands, such as go build and go test, will continue to work indefinitely for legacy GOPATH programs. This was discussed in

Re: [go-nuts] Adding context.Context as first parameter in every function

2024-03-03 Thread 'Yash Bansal' via golang-nuts
@axel Most of the functions I have (except the utility ones) will be needing the context parameter, that's why I thought of adding context to every function, and just using auto-refactoring to remove context from the functions which doesn't use it. @Sam Thanks for providing me with your repo

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread Jeffery Carr
Yes, I do understand the go-source/go-import part, but am I missing something? I don't understand how you would find the go-source other than parsing the HTML I mean 'go get' used to do that for me, do I now have to write a program to do that? I don't understand why that is some bad idea.

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread Kurtis Rader
On Sun, Mar 3, 2024 at 5:05 PM Jeffery Carr wrote: > "You can build large projects with many repos using Go modules. " > > Also, I forgot to add, lots of my repos are binaries, so module things > don't apply. How do I tell someone to download go.wit.com/apps/helloworld? > I can't now with a

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread Jeffery Carr
"You can build large projects with many repos using Go modules. " Also, I forgot to add, lots of my repos are binaries, so module things don't apply. How do I tell someone to download go.wit.com/apps/helloworld? I can't now with a single GO111MODULE=off go get. Can we have 'go download' or can

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread Jeffery Carr
I don't think I understand you. How can I download go.uber.org/zap sources? I need to be able to do it using the "go" binary. I was able to do it before, now I can't. Is there some way to do go download go.uber.org/zap and have it git clone? I don't know how to resolve the git clone path.

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread 'Christian Stewart' via golang-nuts
Hi Jeffery, You can build large projects with many repos using Go modules. Firstly, you can reference the other repos and use the latest "master" version by writing "master" where the v verson is in the file, then use "go mod tidy" Second, you can use "go work" to create a workspace with

Re: [go-nuts] Enums, Go1 and proposals

2024-03-03 Thread Mike Schinkel
I have recently seen many are complaining about a lack of enums in Go. But while there are many ways in which I would like to see Go improved, enums barely even rank on my list of priorities. The majority of my experience prior to Go was with dynamic languages that did not have explicit

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread Jeffery Carr
I guess this boils down to: GO111MODULE=off go get go.uber.org/zap used to git clone into ~/go/src/go.uber.org/zap How am I supposed to do that now? I assume I'm not expected to parse the HTML for the go-import and go-source lines! jcarr -- You received this message because you are

Re: [go-nuts] Data structure code review

2024-03-03 Thread Steven Hartland
Some feedback: Instead of errors.New(emptyDataStructureMessage("stack")) use an emptyDataError type, where it implements the error interface by adding an Error() string method, for example: type emptyDataError string func (e emptyDataError) Error() string { return fmt.Sprintf("not empty %s

Re: [go-nuts] Query Regarding ASAN C Call from Go Code

2024-03-03 Thread Ian Lance Taylor
On Sun, Mar 3, 2024 at 1:25 PM Evgeny Chormonov wrote: > > I noticed that ASAN checker in the Go source code is defined using CGO > https://github.com/golang/go/blob/master/src/runtime/asan/asan.go > But the C ASAN functions are called from the Go runtime using assembly code > instead of a

Re: [go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread Ian Lance Taylor
On Sun, Mar 3, 2024 at 1:25 PM Jeffery Carr wrote: > > Has this been deprecated or maybe it is broken in debian sid, but: > > bash$ GO111MODULE=off go get -v go.wit.com/apps/test > go: modules disabled by GO111MODULE=off; see 'go help modules' > basj$ go version > go version go1.22.0 linux/amd64

[go-nuts] GO111MODULE=off go get deprecated?

2024-03-03 Thread Jeffery Carr
Has this been deprecated or maybe it is broken in debian sid, but: bash$ GO111MODULE=off go get -v go.wit.com/apps/test go: modules disabled by GO111MODULE=off; see 'go help modules' basj$ go version go version go1.22.0 linux/amd64 this doesn't work anymore. Also, 'go help modules' is less than

[go-nuts] Query Regarding ASAN C Call from Go Code

2024-03-03 Thread Evgeny Chormonov
I noticed that ASAN checker in the Go source code is defined using CGO https://github.com/golang/go/blob/master/src/runtime/asan/asan.go But the C ASAN functions are called from the Go runtime using assembly code instead of a common CGO call.

[go-nuts] Data structure code review

2024-03-03 Thread Miss Adorable
Hi! I wrote my first data structure in Go. I wonder how idiomatic my code is to enhance it. Previously, I had C# and Java experience. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: 64 Tiny Algorithmic Puzzles in Go

2024-03-03 Thread BUGFIX 66
Exactly! On Sat, Mar 2, 2024 at 8:37 PM peterGo wrote: > qiulaidongfeng, > > A simpler, solution: > > https://go.dev/play/p/gLY7O_hwyxI > > peter > > On Saturday, March 2, 2024 at 8:25:33 PM UTC-5 qiulaidongfeng wrote: > >> I wrote a correct one, as shown here: >>

[go-nuts] Enums, Go1 and proposals

2024-03-03 Thread Nicolas Serna
Hello, gophers. Lately I've been working quite a bit with enums as I'm moving a C program I had to Go, so I wondered if there was any progress on enums proposals and realized that none of them get anywhere without breaking the Go1 compatibility. I've decided to get a bit creative and share

[go-nuts] Re: c-shared library for Aix

2024-03-03 Thread 'TheDiveO' via golang-nuts
llvm/clang? I've ditched gcc because of its many unfixable problems. After loosing quite some time, trying to cross-compile Go using gcc, I've switched to clang IIRC and this works beautifully, especially cross-building for Alpine/musl. However my AIX time with RS6000 was decades ago, and I

[go-nuts] Re: 64 Tiny Algorithmic Puzzles in Go

2024-03-02 Thread peterGo
qiulaidongfeng, A simpler, solution: https://go.dev/play/p/gLY7O_hwyxI peter On Saturday, March 2, 2024 at 8:25:33 PM UTC-5 qiulaidongfeng wrote: > I wrote a correct one, as shown here: > https://go.dev/play/p/IDJP_iIsGDE > > On Sunday, March 3, 2024 at 1:42:51 AM UTC+8 BUGFIX 66 wrote: > >>

[go-nuts] Re: 64 Tiny Algorithmic Puzzles in Go

2024-03-02 Thread 'qiulaidongfeng' via golang-nuts
I wrote a correct one, as shown here: https://go.dev/play/p/IDJP_iIsGDE On Sunday, March 3, 2024 at 1:42:51 AM UTC+8 BUGFIX 66 wrote: > https://BUGFIX-66.com > > Solve each puzzle by making a tiny change to a short piece of Go code. > Edited code is compiled and tested on the host server. > Each

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
Glad you figured it out. Not certain how requests could crash a process like… I think you’d be better off configuring a maximum heap size rather than having the OOM killer kick in On Mar 2, 2024, at 3:50 PM, Russtopia wrote:SOLVED!Thank you all for the helpful suggestions. Although it has turned

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
SOLVED! Thank you all for the helpful suggestions. Although it has turned out to be something totally different, and a teachable lesson in web app design... This go tool of mine has a very simple web interface with controls for a set of jobs on the main page. The jobs on this list can be run,

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Kurtis Rader
My recommendation is run your program under the control of `strace`. The simplest way to do that is to rename the current program you're launching by adding something like a ".orig" extension. Then create a script with the name of the program containing this: #!/bin/sh exec strace -o

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
I’m guessing some other library or package you installed has corrupted your Linux installation. Sadly, my suggestion would be a fresh install of Linux. On Mar 2, 2024, at 1:58 PM, Russtopia wrote:It no longer does.. so it suggests to me there's something external that has changed, but I have no

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
.. I should add that I have often completely restarted the go program during testing here, so I don't think it could be a case of some long-term 'leak' in the go tool's own code since it's been relaunched and doesn't have any big 'state' to restore or anything. On Sat, Mar 2, 2024 at 7:57 PM

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
It no longer does.. so it suggests to me there's something external that has changed, but I have no clue as to what that might be -- as the process being started by my go tool will run just fine from a shell. And, it *does* run fine on my laptop (which granted is beefier, but again this server was

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
Please clarify - does it work using the older versions of Go?On Mar 2, 2024, at 12:53 PM, Russtopia wrote:I have tried rebuilding with go1.18.6, go1.15.15 with no difference.On Sat, Mar 2, 2024 at 6:23 PM Robert Engels wrote:I would  be also try reverting the Go version

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
I have tried rebuilding with go1.18.6, go1.15.15 with no difference. On Sat, Mar 2, 2024 at 6:23 PM Robert Engels wrote: > I would be also try reverting the Go version and ensure that it continues > to work. Other system libraries may have been updated. > > > On Mar 2, 2024, at 12:05 PM, Ian

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
Hi, I tried outputting the value of werr.(*exec.ExitError).Stderr, but it's empty. Outputting all of werr.(*exec.ExitError) via fmt.Printf("[job *ExitError:%+v]\n", werr.(*exec.ExitError)) ..gives merely [job *ExitError:signal: killed] On Sat, Mar 2, 2024 at 6:04 PM Ian Lance Taylor wrote:

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Robert Engels
I would be also try reverting the Go version and ensure that it continues to work. Other system libraries may have been updated. > On Mar 2, 2024, at 12:05 PM, Ian Lance Taylor wrote: > > On Sat, Mar 2, 2024 at 9:59 AM Russtopia wrote: >> >> Symptom: mysterious "signal: killed"

Re: [go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Ian Lance Taylor
On Sat, Mar 2, 2024 at 9:59 AM Russtopia wrote: > > Symptom: mysterious "signal: killed" occurrences with processes spawned from > Go via exec.Cmd.Start()/Wait() The first step is to tell us the exact and complete error that you see. "signal: killed" can have different causes, and the rest of

[go-nuts] Plea for help diagnosing strange "signal: killed" issues in previously-working code

2024-03-02 Thread Russtopia
Hi all, Symptom: mysterious "signal: killed" occurrences with processes spawned from Go via exec.Cmd.Start()/Wait() Actors: 'Server': Intel i5, running Funtoo 1.4 - 4GB RAM, 4GB swap 'Laptop': Intel Core i7 9thGen, running Devuan Chimaera - 15GB RAm, 15GB swap A quite small -- ~900 lines of

[go-nuts] c-shared library for Aix

2024-03-02 Thread Anshuman Mor
I have written multiple c-shared libraries code in golang for Windows, Linux, MacOS . I am using GCC cross compiler for the same. This code is running fine in production without any issue since last 3 years. But, we have recently got a requirement to compile the same thing for AIX/PowerPC but

[go-nuts] 64 Tiny Algorithmic Puzzles in Go

2024-03-02 Thread BUGFIX 66
https://BUGFIX-66.com Solve each puzzle by making a tiny change to a short piece of Go code. Edited code is compiled and tested on the host server. Each puzzle is a useful little algorithm or idea. Unfortunately, most users can't solve puzzle #3 and give up. Enjoy. -- You received this message

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 6:17 PM Robert Engels wrote: > > The could be calling fork() as in the system call - which copies all file > descriptors but I didn’t think Go processes could fork. > > Seems you would need to remap stdin and stdout in the fork to do anything > useful. > > This sounds

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Robert Engels
The could be calling fork() as in the system call - which copies all file descriptors but I didn’t think Go processes could fork. Seems you would need to remap stdin and stdout in the fork to do anything useful. This sounds very PHP - what goes around comes around. > On Mar 1, 2024, at 8:01 

Re: [go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 5:57 PM Jeff Stein wrote: > > I'm struggling to understand if I'm able to do something. > > > In my very odd use case we are writing a websever that handles connections > via a forked process. > > I have a listener process that listens for TCP connections. > > So each

[go-nuts] Limiting File Descriptors on Forked Linux cmd.exec

2024-03-01 Thread Jeff Stein
I'm struggling to understand if I'm able to do something. In my very odd use case we are writing a websever that handles connections via a forked process. I have a listener process that listens for TCP connections. So each net.Conn that comes in we pull off its file descriptor: *fd, err :=

Re: [go-nuts] Adding context.Context as first parameter in every function

2024-03-01 Thread Sam Vilain
Hi Yash, unfortunately that's the only approach at the moment. Your request is very apropos of my thread, "Could we trade all the `ctx context.Context` arguments for one pointer in `g`?". This is the exact use case I have in mind.  I believe it should be possible, and even a fairly naïve

Re: [go-nuts] Re: How to have panic messages show in a PowerShell console

2024-03-01 Thread 'BENTLEY Thom' via golang-nuts
I just discovered that the executable is created using -ldflags -H=windowsgui. Because of that, I need to pipe to out-text in a PowerShell to see Println output but that doesn’t show the panics. If I remove the flags, then I can see all the output. I don’t know if they are absolutely needed so

Re: [go-nuts] Do we need to drain a closed channel ?

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 6:26 AM Shubha Acharya wrote: > > I have been working with buffered channels. I have stumbled upon a scenario > where buffered channel will be closed and the receivers of the channel > terminates before consuming all the elements in the buffer. So my question is > will

Re: [go-nuts] Re: How to have panic messages show in a PowerShell console

2024-03-01 Thread Ian Lance Taylor
On Fri, Mar 1, 2024 at 5:09 AM jake...@gmail.com wrote: > > FWIW, in a very simple test on Windows 10 in a powershell console, running a > go executable built with go1.19 prints the panic just like in a regular cmd > console. There have been a lot of changes related to Windows consoles since

[go-nuts] Do we need to drain a closed channel ?

2024-03-01 Thread Shubha Acharya
Hey, I have been working with buffered channels. I have stumbled upon a scenario where buffered channel will be closed and the receivers of the channel terminates before consuming all the elements in the buffer. So my question is will there be any issue regarding Garbage Collection of channel

Re: [go-nuts] I am having trouble getting go.crypto ssh client to connect

2024-03-01 Thread My Xaomix
The error message "ssh: unable to authenticate, no supported methods remain" typically indicates that the SSH client and server were unable to negotiate a mutually supported authentication method. In your code, you're using password authentication (ssh.ClientAuthPassword), but it seems like

Re: [go-nuts] adding context.Context to new code

2024-03-01 Thread 'Yash Bansal' via golang-nuts
@nazri Were you able to achieve this? Adding context to every function. Is there any repository/library available for the same. I have been one of the unaware ones who started writing a new service without adding context explicitly. On Friday, May 19, 2017 at 9:34:22 AM UTC+5:30 Nazri Ramliy

[go-nuts] Adding context.Context as first parameter in every function

2024-03-01 Thread 'Yash Bansal' via golang-nuts
Hello, I recently started writing code in Golang and wasn't aware that unlike Java, we can't use ThreadLocals to propagate a context across the code. It's mandatory to explicitly pass a context. I have already written a service which is live in production now, however for monitoring and other

[go-nuts] Re: How to have panic messages show in a PowerShell console

2024-03-01 Thread jake...@gmail.com
FWIW, in a very simple test on Windows 10 in a powershell console, running a go executable built with go1.19 prints the panic just like in a regular cmd console. On Wednesday, February 28, 2024 at 3:20:55 PM UTC-5 Thom BENTLEY wrote: > Hi All, > > OS: Windows 10 > GoLang: go1.6.3 windows/386

Re: [go-nuts] x/pkgsite docs wrongly assume $PATH includes $GOPATH/bin

2024-02-29 Thread kredop...@gmail.com
I've created an issue for this on Golang's Github , let's see where that goes. I went for the "let's add to the docs first" approach for now. Thanks for the convo! On Thursday 29 February 2024 at 09:25:00 UTC+1 Axel Wagner wrote: > On Thu, Feb 29,

[go-nuts] logout/end session

2024-02-29 Thread Alex Kiprono
Using token and the log in request struct i.e (userId, sessionId, timestamp) i generated a login/auth for log in process by creating and merging the request payload to generate the signature thus comparing for varification so the user is active in the system how will i end the session using

[go-nuts] Re: [security] Go 1.22.1 and Go 1.21.8 pre-announcement

2024-02-29 Thread 'Carlos Amedee' via golang-nuts
Hello gophers, We accidentally repeated one of the CVEs in the pre-announcement. The correct list of CVEs being fixed are: - CVE-2024-24783 - CVE-2023-45290 - CVE-2023-45289 Thanks, Carlos for the Go team On Thursday, February 29, 2024 at 6:29:01 PM UTC-5 annou...@golang.org wrote:

[go-nuts] [security] Go 1.22.1 and Go 1.21.8 pre-announcement

2024-02-29 Thread announce
Hello gophers, We plan to issue Go 1.22.1 and Go 1.21.8 during US business hours on Tuesday, March 5. These minor releases include PRIVATE security fixes to the standard library, covering the following CVEs: - CVE-2023-45289 - CVE-2023-45290 - CVE-2023-45289 Following our

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-29 Thread Sam Vilain
Thanks for your examples!  I'll cover them in reverse order, to build up the syntax. On 2/29/24 6:18 AM, 'TheDiveO' via golang-nuts wrote: The second example is unit test code, so TEST:

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-29 Thread tapi...@gmail.com
On Thursday, February 29, 2024 at 7:04:14 PM UTC+8 Axel Wagner wrote: Yes. It means "violating a rule, without setting a precedent for future violations". One of the main objections to the loop variable change has been the breaking of compatibility and the fear of setting a precedent for

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-29 Thread tapi...@gmail.com
On Thursday, February 29, 2024 at 3:14:40 PM UTC+8 Axel Wagner wrote: The loop var change *does* break compatibility. And it did so knowingly and - as clearly explained - was an exception. Stop arguing in bad faith. An exception. :D On Thu, Feb 29, 2024 at 7:03 AM tapi...@gmail.com

[go-nuts] gomobile - no stack traces on Android

2024-02-29 Thread Brien Colwell
With gomobile, I’m not able to see stack traces for errors in the native library. For example: ``` 02-29 00:50:16.021 10940 0 E Go : panic: runtime error: invalid memory address or nil pointer dereference 02-29 00:50:16.021 10940 0 E Go : [signal SIGSEGV: segmentation

Re: [go-nuts] x/pkgsite docs wrongly assume $PATH includes $GOPATH/bin

2024-02-29 Thread 'Axel Wagner' via golang-nuts
On Thu, Feb 29, 2024 at 9:12 AM kredop...@gmail.com wrote: > Apologies - sent the response only to you, so I'll write it again here. > > > Doesn't the `go install` command explicitly instruct you to add > $GOBIN/$GOPATH/bin to your $PATH? > > I did check both golang installation docs and the

Re: [go-nuts] x/pkgsite docs wrongly assume $PATH includes $GOPATH/bin

2024-02-29 Thread kredop...@gmail.com
Apologies - sent the response only to you, so I'll write it again here. > Doesn't the `go install` command explicitly instruct you to add $GOBIN/$GOPATH/bin to your $PATH? I did check both golang installation docs and the output of `go help install` - it's very possible I'm missing something,

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-28 Thread 'Axel Wagner' via golang-nuts
The loop var change *does* break compatibility. And it did so knowingly and - as clearly explained - was an exception. Stop arguing in bad faith. On Thu, Feb 29, 2024 at 7:03 AM tapi...@gmail.com wrote: > > > On Wednesday, February 28, 2024 at 3:19:37 PM UTC+8 Axel Wagner wrote: > > That would

Re: [go-nuts] Equality of interface of an empty struct - why?

2024-02-28 Thread tapi...@gmail.com
On Wednesday, February 28, 2024 at 3:19:37 PM UTC+8 Axel Wagner wrote: That would break backwards compatibility, though. And it would be a re-definition (i.e. existing code would compile, but behave differently at runtime) and is hence not allowed even under the Go 2 transition rules. With

Re: [go-nuts] x/pkgsite docs wrongly assume $PATH includes $GOPATH/bin

2024-02-28 Thread 'Axel Wagner' via golang-nuts
Doesn't the `go install` command explicitly instruct you to add $GOBIN/$GOPATH/bin to your $PATH? To me, that seems enough - it feels a bit arduous, to expect this piece of information at any single point on the web where `go install` is mentioned. On Thu, Feb 29, 2024 at 1:39 AM Robert Sawicki

Re: [go-nuts] How to have panic messages show in a PowerShell console

2024-02-28 Thread Kurtis Rader
On Wed, Feb 28, 2024 at 4:39 PM 'BENTLEY Thom' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Thanks Jim. > At the moment, I’m using the 1.6.3 version as specified in the internal > documentation the project I’m learning. > I would definitely like to upgrade go to a much later version.

RE: [go-nuts] How to have panic messages show in a PowerShell console

2024-02-28 Thread 'BENTLEY Thom' via golang-nuts
Thanks Jim. At the moment, I’m using the 1.6.3 version as specified in the internal documentation the project I’m learning. I would definitely like to upgrade go to a much later version. Just don’t want to do it before I know it works on the specified version. From: Jim Idle Sent: Wednesday,

[go-nuts] x/pkgsite docs wrongly assume $PATH includes $GOPATH/bin

2024-02-28 Thread Robert Sawicki
Hey! As I was looking through Go docs recently, I've noticed docs for x/pkgsite wrongly assume that user's $PATH includes $GOPATH/bin, by using `pkgsite` as a way to launch the command right after installing it. Golang installation docs only mention adding

Re: [go-nuts] How to have panic messages show in a PowerShell console

2024-02-28 Thread 'Jim Idle' via golang-nuts
You should upgrade your Go installation to the latest version and retry. Go 1.6.3, if that is not a typo is very old. Jim On Feb 28 2024, at 11:35 am, Thom BENTLEY wrote: > Hi All, > > OS: Windows 10 > GoLang: go1.6.3 windows/386 > > I am trying to have a go executable run and show the panics

[go-nuts] How to have panic messages show in a PowerShell console

2024-02-28 Thread Thom BENTLEY
Hi All, OS: Windows 10 GoLang: go1.6.3 windows/386 I am trying to have a go executable run and show the panics it causes in the PowerShell console. I think I can use GODEBUG, but all the examples I've seen so far are for Linux. I've set that variable to paniclog=1, but nothing changed. If

Re: [go-nuts] Could we trade all the `ctx context.Context` arguments for one pointer in `g`?

2024-02-28 Thread Sam Vilain
Hey, thanks for raising this important use case.  Do you have any specific examples in mind you could point to? I think the answer should follow easily from what defines a new scope.  New scopes get their own mini-stack frame created, and in that frame the context pointer can be saved like

Re: [go-nuts] assert library with generics?

2024-02-28 Thread Harri L
I’m biased as well. FWIW, this is a subpackage of the error handling solution, err2 . The assertion pkg is proven to be a precious tool for many projects. It is unique because it can be used both for

<    1   2   3   4   5   6   7   8   9   10   >