[go-nuts] Re: Go 1.17.1 runtime seems retain too much memory from OS

2022-11-23 Thread 'Zhao Weng' via golang-nuts
sorry for being not specific. my question is: according to my understanding about memstat ( correct me if I'm wrong) with GOGC set to 50, I can see from the graph above that GCGoal is ~ 26GB and heapIdle - heapReleased is how much memory go runtime retain from OS for later usage, how can it (he

[go-nuts] Re: Go 1.17.1 runtime seems retain too much memory from OS

2022-11-23 Thread Amnon
Have a look at https://tip.golang.org/doc/gc-guide and https://opensourcelive.withgoogle.com/events/go-day-2022/watch?talk=talk4 On Thursday, 24 November 2022 at 05:08:55 UTC Zhao Weng wrote: > [image: memory.jpg] > memstats show heapIdle - heapReleased > heapAlloc or heapInUse > > I try to sea

Re: [go-nuts] Problems with array slicing reliability?

2022-11-23 Thread Amnon
As others have said, it is worth trying to reduce the program to the minimal version which reproduces your problem (and then publishing it on https://go.dev/play/ ). On Thursday, 24 November 2022 at 02:38:30 UTC kra...@skepticism.us wrote: > You cannot mutate strings. Your code is also missing

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread robert engels
Your reading comprehension skills need some work. The point of “labels matter” was answering Rob Pike’s “why does it matter” question. I used extremely different objects - yet both modes of transportation - intentionally to highlight the need for common definitions in order to communicate. Th

[go-nuts] Please help me with structure data alignment

2022-11-23 Thread Maxim Velivanov
Hi, I'm developing a Go wrapper for a dll. dll contains the following structure: struct ck_version { unsigned char major; unsigned char minor; }; struct ck_info { struct ck_version cryptoki_version; unsigned char manufacturer_id[32]; ck_flags_t flags; unsigned char library_description

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread Holloway Kean Ho
> I think the amount of hair-splitting over what is an object oriented language is reason to say it *isn't* an Object Oriented language at all. Given the FAQ header's "Is Go an object-oriented language? emphasizing that "object-oriented" is in lowercase, not the titlecase "Object-Oriented" that

Re: [go-nuts] Re: clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread Ayan George
Rob Pike wrote: > Let me ask, because I'm genuinely curious: Why does it matter? The labels > we apply to things do not affect their function. Perhaps it affects how we > think about them. Is that it? > Yes -- that's it exactly! I think the amount of hair-splitting over what is an object orient

[go-nuts] Re: cgo and Python as a shared library

2022-11-23 Thread Deiter
Doh! I forgot the include. I get a linker error now: ... package main /* #cgo pkg-config: python3 #cgo LDFLAGS: -lpython3.8 #include */ import "C" import ( "fmt" ) func main() { C.Py_Initialize() fmt.Println(C.GoString(C.Py_GetVersion())) C.Py_Finalize() } ... $ go run . # producer /usr/local/g

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread robert engels
I am not sure what you are trying to say here. > On Nov 23, 2022, at 8:36 PM, Holloway Kean Ho > wrote: > > Your examples have something to do with the developer's psychological problem > for failing to distingush between objects; not OO, OOP, or any programming > languages. Neither Java or

[go-nuts] cgo and Python as a shared library

2022-11-23 Thread Deiter
macOS: 12.5.1 go: go1.19.3 darwin/amd64 I'm having trouble building a go module that uses Python as a shared library. This code works: ... package main // #include import "C" import "fmt" func main() { fmt.Println("Max float value of float is", C.FLT_MAX) } ... $ go run . Max float value of

Re: [go-nuts] Re: How to High-pass filter method for well height data

2022-11-23 Thread Harris, Andrew
You might not need FFT for this problem, although it's a powerful tool that would work The minimal LP/HP filter is very little code, https://ccrma.stanford.edu/~jos/filters/Definition_Simplest_Low_Pass.html From: golang-nuts@googlegroups.com on behalf of pat

Re: [go-nuts] Problems with array slicing reliability?

2022-11-23 Thread Kurtis Rader
You cannot mutate strings. Your code is also missing a final close-brace and possibly has other problems. That your example includes commented out code is also problematic. As Nikhilesh Susarla pointed out you should post a link to the Go playground to avoid any ambiguity. I added the missing clos

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread Holloway Kean Ho
> If the answer to that question is "yes and no," it'd be less ambiguous to simply say, "no." And that would be a definitive way of indicating that it woul be inappropriate to apply many patterns from object oriented languages to Go -- and to encourage people to accept Go for what it is. Go doe

[go-nuts] Re: Problems with array slicing reliability?

2022-11-23 Thread Nikhilesh Susarla
Before anyone takes a look, can you please place the code in https://go.dev/play/ and then share that link where the code compiles and if it works on the browser and you have specific settings for goarch and goos then gophers can take a look at it. Thank you On Thursday, 24 November 2022 at 0

Re: [go-nuts] cannot initialize 1 variables with 2 values

2022-11-23 Thread Kurtis Rader
Perhaps explicitly capture the error value? That is, result, err := GetAsOr[MyObj](services.GetServiceOr()) Alternatively, if you don't care if there is an error replace "err" with "_" to make that clear. On Wed, Nov 23, 2022 at 4:34 PM Denis P wrote: > Hi guys, > > Does anyone know how to pas

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread robert engels
Human beings survive by classifications and compartmentalizing. Applying a label associates it with certain traits. If someone said “I have a car for sale”, and you showed up and it had no wheels but a hull and a sail - you might be a bit upset. Whether Go is a car or a boat is up to the expert

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread Kurtis Rader
Show us the output of `which go`. I'm not convinced you're using a native Linux Go compiler. On Wed, Nov 23, 2022 at 5:31 PM pat2...@gmail.com wrote: > Just in case my use of the "windows installer" for go and then using > WSL/bash > >> was confusing assorted magic env variables, I uninstalled/d

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread Kurtis Rader
In your reply to the request for `go env` output you say "For all of the above I am using WSL (bash under Windows 11)". It looks like you're using the native Windows Go toolchain from WSL. I would not expect that to work and that is likely the reason you're having problems. You should install Go fo

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread pat2...@gmail.com
Just in case my use of the "windows installer" for go and then using WSL/bash > was confusing assorted magic env variables, I uninstalled/deleted the Windows installed version then I downloaded the "linux" version, and did the usual "sudo tar " install Made no difference Get the same error mess

Re: [go-nuts] Re: clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread Rob Pike
Let me ask, because I'm genuinely curious: Why does it matter? The labels we apply to things do not affect their function. Perhaps it affects how we think about them. Is that it? -rob -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscrib

Re: [go-nuts] Shellquote in stdlib

2022-11-23 Thread 'Christian Stewart' via golang-nuts
Hi Kurtis, On Wed, Nov 23, 2022, 4:57 PM Kurtis Rader wrote: > On Wed, Nov 23, 2022 at 7:33 AM Christian Stewart > wrote: > >> This is what I'm trying to accomplish: >> >> Start delve (dlv) with os/exec passing a set of []string os.Args as >> --build-flags >> >> Let's say I have this build argu

Re: [go-nuts] Shellquote in stdlib

2022-11-23 Thread Kurtis Rader
On Wed, Nov 23, 2022 at 7:33 AM Christian Stewart wrote: > This is what I'm trying to accomplish: > > Start delve (dlv) with os/exec passing a set of []string os.Args as > --build-flags > > Let's say I have this build arguments set: []string{"-gcflags", "-N -l"} > > - How can I pass this to --bu

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread pat2...@gmail.com
On Wednesday, November 23, 2022 at 7:00:35 PM UTC-5 kra...XXX wrote: > On Windows Go is normally installed to C:\Program Files\Go. You should not > put your source code inside that directory. Put the source for your > projects somewhere else such as %HOME%/go. > My source files are not under "C

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread pat2...@gmail.com
On Wednesday, November 23, 2022 at 6:31:51 PM UTC-5 se... wrote: > output of `go env` please > I am using WSL (bash under Windows 11) Shell env: env HOSTTYPE=x86_64 LESSCLOSE=/usr/bin/lesspipe %s %s LANG=C.UTF-8 WSL_DISTRO_NAME=Ubuntu USER=pfarrell PWD=/home/pfarrell/whome/sandbox/gows/tre

[go-nuts] cannot initialize 1 variables with 2 values

2022-11-23 Thread Denis P
Hi guys, Does anyone know how to pass it properly and without adding extra lines of code? ``` func GetAsOr[T any](t interface{}, e error) (T, error) { return t.(T), e } func (s ServiceProvider) GetServiceOr() (interface{}, error) { } result := GetAsOr[MyObj](services.GetServiceOr()

[go-nuts] Re: clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread Kamil Ziemian
"But I feel like programmers bringing their ideas from other less ambiguously object oriented languages like Java and C++ often have difficulty writing idiomatic Go." I personally think that Java and C++ are less ambiguously OOP, only because we informally define OOP language as "language that i

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread Kurtis Rader
On Windows Go is normally installed to C:\Program Files\Go. You should not put your source code inside that directory. Put the source for your projects somewhere else such as %HOME%/go. On Wed, Nov 23, 2022 at 3:26 PM pat2...@gmail.com wrote: > I've separated my code into separate subdirectories

Re: [go-nuts] clarifying Go FAQ: Is Go an object-oriented language?

2022-11-23 Thread Kamil Ziemian
I think in the 1990s it was a debate if Lisp with Common List Object System (CLOS) is OOP language. The answer they arrive was something like that. "No, if your definition of OOP is based on C++. But, why your definition of OOP should be based on C++?" I think the same fits Go. Go is in many way

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread 'Sean Liao' via golang-nuts
output of `go env` please - sean On Wed, Nov 23, 2022 at 11:25 PM pat2...@gmail.com wrote: > I've separated my code into separate subdirectories, added a go.mod > ran go mod tidy on each. > > I'm mostly back where I started, which a better source file tree > > I'm trying to test the "treesort"

Re: [go-nuts] where is GOROOT set?

2022-11-23 Thread pat2...@gmail.com
I've separated my code into separate subdirectories, added a go.mod ran go mod tidy on each. I'm mostly back where I started, which a better source file tree I'm trying to test the "treesort" package from the "Donovan and Kernigan" The Go programing language book. When I connect into the treeso

[go-nuts] Re: How to High-pass filter method for well height data

2022-11-23 Thread pat2...@gmail.com
You want to find a discrete fast fourier transform package. convolve with a suitable filter, and then inverse the DFFT -- 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 emai

Re: [go-nuts] any Go based supervisor alternative?

2022-11-23 Thread robert engels
It seems if you do it that way - you get all or nothing. Meaning if you have access to the socket - you can issue any command that is registered, and also start/stop any service with no further access controls. Still, I looked at the code you referenced, and if you look at the caller here https

Re: [go-nuts] Re: any Go based supervisor alternative?

2022-11-23 Thread Ben Hoyt
I presume you're referring to API access? I wasn't around when the initial API and access control stuff was designed (it's inherited from snapd), but here's my understanding of how it works. The bulk of the API is exposed using HTTP-over-unix-socket, so is only accessible if you have permission to

[go-nuts] Problems with array slicing reliability?

2022-11-23 Thread Mucas Schlack
Hello Golangers! Is there anyone who can test the reliability of the following Golang slice feature? I am using an AMG64 computer with Windows 10, and Go version 0.36.0. When I use the following code, to detect and then replace a character at any given length *n* (9) in a string with an Uppercas

Re: [go-nuts] Re: any Go based supervisor alternative?

2022-11-23 Thread Robert Engels
I took a look at Pebble. I don’t see anything related to auth and credentials and it seems like a huge back door security hole. Did I miss something? > On Nov 23, 2022, at 3:20 PM, ben...@gmail.com wrote: > >  > Part of my day job is working on Canonical's "Pebble" > (https://github.com/can

Re: [go-nuts] Re: any Go based supervisor alternative?

2022-11-23 Thread Robert Engels
I would manage this externally. As complex as Kubernetes or as simple as initd. > On Nov 23, 2022, at 1:01 PM, Mathieu CARBONNEAUX > wrote: > > https://github.com/ochinchina/supervisord is a go version of supervisord > >> Le mercredi 23 juillet 2014 à 03:02:36 UTC+2, kard...@gmail.com

[go-nuts] Re: any Go based supervisor alternative?

2022-11-23 Thread ben...@gmail.com
Part of my day job is working on Canonical's "Pebble" (https://github.com/canonical/pebble), a simple service manager written in Go. Unique features: layered configuration, and an HTTP-over-unix-socket API. It's GPLv3 licensed. -Ben On Monday, July 21, 2014 3:51:12 PM UTC-7, ChrisLu wrote: >>>

Re: [go-nuts] cgo Handle doc

2022-11-23 Thread Ian Lance Taylor
On Wed, Nov 23, 2022 at 9:25 AM Frédéric De Jaeger wrote: > > There is something that puzzles me a lot in the doc about cgo.Handle there > https://pkg.go.dev/runtime/cgo. It says: > > Some C functions accept a void* argument that points to an arbitrary data > value supplied by the caller. It is

[go-nuts] Re: any Go based supervisor alternative?

2022-11-23 Thread Mathieu CARBONNEAUX
https://github.com/ochinchina/supervisord is a go version of supervisord Le mercredi 23 juillet 2014 à 03:02:36 UTC+2, kard...@gmail.com a écrit : > godoc.org/bitbucket.org/kardianos/service > > On Monday, July 21, 2014 3:51:12 PM UTC-7, ChrisLu wrote: >> >> I am tasked to start a go service

[go-nuts] How to High-pass filter method for well height data

2022-11-23 Thread TAERHEE
Hi all, I am new to go, for studying engineer graduate course for late age at night school My senior college want to test me digital filter with the well logging data. It must be done with go-lang. If I failed, I have to buy dinner for 10 people for the group test LOL. this data was sampled bet

[go-nuts] cgo Handle doc

2022-11-23 Thread Frédéric De Jaeger
Hi, There is something that puzzles me a lot in the doc about cgo.Handle there https://pkg.go.dev/runtime/cgo. It says: *Some C functions accept a void* argument that points to an arbitrary data value supplied by the caller. It is not safe to coerce a cgo.Handle (an integer) to a Go unsafe.Po

Re: [go-nuts] Shellquote in stdlib

2022-11-23 Thread 'Christian Stewart' via golang-nuts
Kurtis, This is what I'm trying to accomplish: Start delve (dlv) with os/exec passing a set of []string os.Args as --build-flags Let's say I have this build arguments set: []string{"-gcflags", "-N -l"} - How can I pass this to --build-flags in Delve? strings.Join(flags, " ") is wrong. - How c