Re: [go-nuts] Question about strings.EqualFold vs Python's casefold

2020-04-30 Thread Ian Lance Taylor
On Thu, Apr 30, 2020 at 9:42 PM Miki Tebeka wrote: > > I'm trying to find an example where strings.EqualFold returns true but > comparison of strings.ToLower fails. > I've found this example (in Python): > > s1 = "der Fluß" > s2 = "der Fluss" > > print('lower', s1.lower() == s2.lower()) >

[go-nuts] Question about strings.EqualFold vs Python's casefold

2020-04-30 Thread Miki Tebeka
Hi, I'm trying to find an example where strings.EqualFold returns true but comparison of strings.ToLower fails. I've found this example (in Python): s1 = "der Fluß" s2 = "der Fluss" print('lower', s1.lower() ==

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Trig
Kurtis, Thanks... that 'Cheat Engine' is the correct one. Basically, what I am doing is creating a simple service that watches for a particular process (a game, in this instance) and 'monitors' certain values (such as life levels, mana levels, etc.). If my health in the game is low, it

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Kurtis Rader
On Thu, Apr 30, 2020 at 8:25 PM Eric Brown wrote: > I’ll look into this solution. Thank you for an answer that points me in a > possible direction. > Gah! I hit the "send" button without providing any useful response in my previous reply. Note that reading /proc/$pid/mem is only applicable to

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Kurtis Rader
On Thu, Apr 30, 2020 at 8:25 PM Eric Brown wrote: > I’ll look into this solution. Thank you for an answer that points me in a > possible direction. > > On Thu, Apr 30, 2020 at 10:24 PM Robert Engels > wrote: > >> This can be done fairly easily if you run the Go process as root and read >> the

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Eric Brown
I’ll look into this solution. Thank you for an answer that points me in a possible direction. On Thu, Apr 30, 2020 at 10:24 PM Robert Engels wrote: > This can be done fairly easily if you run the Go process as root and read > the /proc/$pid/mem pseudo file. > > On Apr 30, 2020, at 10:01 PM,

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Robert Engels
This can be done fairly easily if you run the Go process as root and read the /proc/$pid/mem pseudo file. > On Apr 30, 2020, at 10:01 PM, Michael Jones wrote: > >  > The general dangerous ability to do this is why protected mode went into the > i368 and is the first and most essential

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Eric Brown
I’m attempting to do exactly what ‘Cheat Engine’ and things like AutoHotKey can do. ‘Cheat Engine’ handles this just fine on all my platforms. On Thu, Apr 30, 2020 at 10:01 PM Michael Jones wrote: > The general dangerous ability to do this is why protected mode went into > the i368 and is the

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Michael Jones
The general dangerous ability to do this is why protected mode went into the i368 and is the first and most essential promise to prevent of every OS other than MS DOS, original MacOS, and practically the threads in shared memory model of Smalltalk & MP Mathematica. On Thu, Apr 30, 2020 at 7:13 PM

Re: [go-nuts] Safe ways to call C with less overhead

2020-04-30 Thread Michael Jones
Function call intensity seems directly addressed by a tree or DAG like chain of command buffers, not necessarily a full scene graph (with logic and selection) but a call at the top and traverse tool to let you make just a few cgo transitions to c per frame. I’ve done this several ways myself

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Kurtis Rader
On Thu, Apr 30, 2020 at 6:59 PM Trig wrote: > I'm attempting to read memory from another process. I've installed 'Cheat > Engine' to do this, to make sure I'm pulling the correct value from the > address I'm attempting to; however, nothing I found works I did find this > article: > > >

Re: [go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Ian Lance Taylor
On Thu, Apr 30, 2020 at 6:58 PM Trig wrote: > > I'm attempting to read memory from another process. I've installed 'Cheat > Engine' to do this, to make sure I'm pulling the correct value from the > address I'm attempting to; however, nothing I found works I did find this > article: > >

[go-nuts] getting values from memory addresses within another process...

2020-04-30 Thread Trig
I'm attempting to read memory from another process. I've installed 'Cheat Engine' to do this, to make sure I'm pulling the correct value from the address I'm attempting to; however, nothing I found works I did find this article:

Re: [go-nuts] URL parsing with special characters.

2020-04-30 Thread Kurtis Rader
On Thu, Apr 30, 2020 at 10:05 AM Vivek wrote: > I am trying to parse a url similar to "ftp:// > user:pass@192.168.0.1/path/file%ver3.txt" using `net/url` Parse function > but I am getting a error > > `parse "ftp://user:pass@192.168.0.1/path/file%ver3.txt": invalid URL > escape "%ve"` > That is

Re: [go-nuts] Re: cgo can't find .so in same directory

2020-04-30 Thread Ian Lance Taylor
On Thu, Apr 30, 2020 at 10:06 AM wrote: > > https://golang.org/cmd/cgo/ > > When the cgo directives are parsed, any occurrence of the string ${SRCDIR} > > will be replaced by the absolute path to the directory containing the > > source file. > > So this might be what you need. > > #cgo LDFLAGS:

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Dean Schulze
That works. The problem I had earlier with a panic was caused by my C library which was returning null as an error condition. Once the C code was fixed it worked as you said. Thanks. On Thu, Apr 30, 2020 at 2:18 PM Jan Mercl <0xj...@gmail.com> wrote: > On Thu, Apr 30, 2020 at 10:06 PM Dean

Re: [go-nuts] Re: URL parsing with special characters.

2020-04-30 Thread Ian Lance Taylor
On Thu, Apr 30, 2020 at 11:09 AM Brian Candler wrote: > > In a URL, the percent sign should appear as %25 (% marks the start of a > hex-encoded character) > https://play.golang.org/p/gMC1tdpJER4 > > The URL as shown is invalid. I *think* you are saying that the u.Path field should use %25

Re: [go-nuts] Build fails when following build instructions

2020-04-30 Thread 'Martins Eglitis' via golang-nuts
Hi, There was something related in "CMakeError.log": Determining if the mmap exist failed with the following output: Change Dir: /home/gopher/workarea/build-debug/CMakeFiles/CMakeTmp Run Build Command(s):/usr/bin/ninja cmTC_81c99 && [1/2] Building C object

Re: [go-nuts] Build fails when following build instructions

2020-04-30 Thread 'Martins Eglitis' via golang-nuts
Sorry, I should have mentioned that I am running a docker container based on the latest Ubuntu, and Ubuntu 18.04 as the host. On April 30, 2020 11:37:15 PM GMT+03:00, Martins Eglitis wrote: >Yes, > >cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 > > >On April 30, 2020 11:29:07 PM GMT+03:00, Than

Re: [go-nuts] Build fails when following build instructions

2020-04-30 Thread 'Martins Eglitis' via golang-nuts
Yes, cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 On April 30, 2020 11:29:07 PM GMT+03:00, Than McIntosh wrote: >>>/usr/bin/ld.gold: error: >CMakeFiles/cmTC_81c99.dir/CheckSymbolExists.c.o: >failed to match split-stack sequence at section 4 offset 0 > >OK, now I think we're getting somewhere, this

Re: [go-nuts] Build fails when following build instructions

2020-04-30 Thread 'Than McIntosh' via golang-nuts
>>/usr/bin/ld.gold: error: CMakeFiles/cmTC_81c99.dir/CheckSymbolExists.c.o: failed to match split-stack sequence at section 4 offset 0 OK, now I think we're getting somewhere, this looks suspicious. For reference, could you please send me the output of "/usr/bin/cc --version"? Thanks, Than

[go-nuts] Re: Converting a C char[] to []byte of string with cgo

2020-04-30 Thread peterGo
Dean, Command cgo https://golang.org/cmd/cgo/#hdr-Go_references_to_C In C, a function argument written as a fixed size array actually requires a pointer to the first element of the array. C compilers are aware of this calling convention and adjust the call accordingly, but Go cannot. In Go,

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Dean Schulze
> > That compiles but it still panics: > > test: bad machine line11=(null), return > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4949f2] > > goroutine 1 [running]: > main.(*LineStruct).MachineName(...) >

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Bruno Albuquerque
C.GoString((*C.char)(_name)) On Thu, Apr 30, 2020 at 1:21 PM Dean Schulze wrote: > This expression > > C.GoString(C.char*(_name)) > > gives this error: > > type _Ctype_char is not an expression > > On Thu, Apr 30, 2020 at 2:09 PM Bruno Albuquerque wrote: > >> Not pretty but if you

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Dean Schulze
This expression C.GoString(C.char*(_name)) gives this error: type _Ctype_char is not an expression On Thu, Apr 30, 2020 at 2:09 PM Bruno Albuquerque wrote: > Not pretty but if you are sure the array is zero-terminated, you can > simply cast it to the correct type: > >

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Jan Mercl
On Thu, Apr 30, 2020 at 10:06 PM Dean Schulze wrote: > > That gives this error (which I've gotten with just about everything I try): > > cannot use _name (type *[25]_Ctype_char) as type *_Ctype_char in > argument to _Cfunc_GoString Oh yeah, should have been probably `C.GoString([0])`. Forgot Go

[go-nuts] Re: Converting a C char[] to []byte of string with cgo

2020-04-30 Thread mike
C.GoString((*C.char)()) -- 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 email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Bruno Albuquerque
Not pretty but if you are sure the array is zero-terminated, you can simply cast it to the correct type: C.GoString((C.char*)()) (untested) On Thu, Apr 30, 2020 at 1:06 PM Dean Schulze wrote: > That gives this error (which I've gotten with just about everything I try): > > cannot use _name

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Dean Schulze
That gives this error (which I've gotten with just about everything I try): cannot use _name (type *[25]_Ctype_char) as type *_Ctype_char in argument to _Cfunc_GoString It seems to be the fixed length of the char[] that gives cgo a problem. On Thursday, April 30, 2020 at 1:46:34 PM UTC-6, Jan

Re: [go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Jan Mercl
On Thu, Apr 30, 2020 at 8:17 PM Dean Schulze wrote: > > I must be missing something pretty simple, but I have a C struct like this: > > typedef struct line > { > char hostname[HOSTNAME_MAX]; > char ip[IP_MAX]; > ... > } > > When I try to do the simple thing > > C.GoString(p.hostname)

Re: [go-nuts] Why do we use xchg rather than lock mov to inplement atomic.StoreX?

2020-04-30 Thread Keith Randall
Ah, so I guess we don't need a barrier at all on x86 for the release semantics. Presumably we still need something for Dekker-style algorithms, although I don't think we use those anywhere in the stdlib, at least. I guess it's just a question of which is faster? On Tue, Apr 28, 2020 at 8:24 PM

[go-nuts] Re: Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Dean Schulze
I've also tried this var src [24]C.char = p.mach_ip and this var src *[24]C.char = _ip and both give panics. > > -- 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 email

Re: [go-nuts] Using FIPS-compliant boring Go to connect to microsoft.com(specifically)

2020-04-30 Thread David Anderson
(Disclaimer: not a FIPS compliance expert, you should hire your own experts to get authoritative answers) FIPS 140-2 seems to reference FIPS 186-4 for specific algorithm choices. FIPS 186-4 specifies that the RSA modulus shall be 1024, 2048, or 3072 bits. So, as-written, it seems like 4096-bit

[go-nuts] Converting a C char[] to []byte of string with cgo

2020-04-30 Thread Dean Schulze
I must be missing something pretty simple, but I have a C struct like this: typedef struct line { char hostname[HOSTNAME_MAX]; char ip[IP_MAX]; ... } When I try to do the simple thing C.GoString(p.hostname) I get an error like cannot use p.hostname (type [25]_Ctype_char) as type

[go-nuts] Using FIPS-compliant boring Go to connect to microsoft.com(specifically)

2020-04-30 Thread mohit . bits2011
Summary - Trying Boring Go in FIPS mode to connect to Microsoft services (Azure). Intermediate CA Certificate for Microsoft has a 4096 bit public key that is not allowed by Boring Go (Code here

[go-nuts] Re: URL parsing with special characters.

2020-04-30 Thread Brian Candler
In a URL, the percent sign should appear as %25 (% marks the start of a hex-encoded character) https://play.golang.org/p/gMC1tdpJER4 The URL as shown is invalid. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Build fails when following build instructions

2020-04-30 Thread 'Than McIntosh' via golang-nuts
Thanks for the email. Sorry for the delay in responding, this is a very busy time right now for our team (release freeze is happening at the end of this week). Just in general, the gollvm build procedure uses "cmake", and as part of this process cmake is running various tests to make sure that

[go-nuts] Re: cgo can't find .so in same directory

2020-04-30 Thread mike
https://golang.org/cmd/cgo/ > When the cgo directives are parsed, any occurrence of the string ${SRCDIR} will be replaced by the absolute path to the directory containing the source file. So this might be what you need. #cgo LDFLAGS: -L${SRCDIR}/. -lperson On Thursday, 30 April 2020 05:19:36

[go-nuts] URL parsing with special characters.

2020-04-30 Thread Vivek
I am trying to parse a url similar to "f tp://user:pass@192.168.0.1/path/file%ver3.txt" using `net/url` Parse function but I am getting a error `parse "ftp://user:pass@192.168.0.1/path/file%ver3.txt": invalid URL escape "%ve"` https://play.golang.org/p/HE6zlDeIbyq

[go-nuts] Is there a library for validating gmail's Variants

2020-04-30 Thread Walter Peng
Hello community, We are running a small website which allow users registration with their email. Many users use gmail's variants to sign up the site, as we know, foo...@gmail.com is equivalent to below similar: foo...@googlemail.com foob...@googlemail.com foo@gmail.com foobar+...@gmail.com

[go-nuts] Build fails when following build instructions

2020-04-30 Thread sitilge
Hi, I initially opened an issue, but was suggested to post to the mailing list instead: https://github.com/golang/go/issues/38728 Build keeps failing when trying to build (Ubuntu Focal Fossa, amd64) from the latest commit to the master and following the build instructions. Has anyone

[go-nuts] Getting the latest non-tagged version of main module

2020-04-30 Thread Shulhan
Sometimes when I push too fast on one of dependencies, the Go proxy can't catch up the latest non-tagged commit on remote server. So, I need to get the latest module version on tip of git commit using the following shell script, #!/bin/sh MODNAME=$(go list -m) DATE=$(date -u -r `git log -n

[go-nuts] Re: cgo can't find .so in same directory

2020-04-30 Thread Dean Schulze
That was it. It's actually export LD_LIBRARY_PATH=${PWD} On Thursday, April 30, 2020 at 1:05:58 AM UTC-6, Miki Tebeka wrote: > > IMO the #cgo directive is just building the executable, not for running it. > You can set the LD_LIBRARY_PATH environment variable before running the > exeutable >

Re: [go-nuts] Safe ways to call C with less overhead

2020-04-30 Thread Constantine Shablya
Thanks for reply, Ian To clear up, by safety I only mean presence of stack guards or, more generally, means of ensuring the program doesn't silently end up writing past the stack. >From this I take my next step will be to make something between systemstack and asmcgocall so that I still run

Re: [go-nuts] json decode is very slow

2020-04-30 Thread Sarath Prabath Redlapalli Jaya
Thanks Amnon & Hi Jesper, You're correct. Most of the time is actually spent in *ioutil.ReadAll()* . Trying to debug network issues related to GCP, GKE & the functionality of ISTIO sidecar reverse proxy, but seems okay so far couldn't find anything. But, I've performed an interesting experiment.

Re: [go-nuts] json decode is very slow

2020-04-30 Thread Jesper Louis Andersen
On Tue, Apr 28, 2020 at 6:48 PM Sarath Prabath Redlapalli Jaya < harrysarath2...@gmail.com> wrote: > We've instrument the above code block and reading request body bytes is > taking very long i.e., upto 5 secs sometimes reaching upto 20 seconds at the > throughput of ~4-5K RPM > > > The Request

[go-nuts] Re: json decode is very slow

2020-04-30 Thread Amnon Baron Cohen
encoding/json is quite old and not particularly fast. There are some other implementations around which use code generation rather than reflection, and which claim to give a speedup of 3x or meore I would try one of them: https://github.com/mailru/easyjson or https://github.com/pquerna/ffjson

Re: [go-nuts] Store function name as JSON?

2020-04-30 Thread Brian Candler
Or initialize a map with your functions, and lookup in the map. -- 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 email to golang-nuts+unsubscr...@googlegroups.com. To view

[go-nuts] About text-based user interface for Windows and Linux

2020-04-30 Thread 洪嘉鴻
Hello everyone: I use golang with Win10. I want to make some text-based user interface executables for Windows and Linux. There are sure many libraries about text-based user interface, such as tcell, termbox, gocui, termui, tui, tview, and so on. However, the boxes and some words are cut while

[go-nuts] Re: cgo can't find .so in same directory

2020-04-30 Thread Miki Tebeka
IMO the #cgo directive is just building the executable, not for running it. You can set the LD_LIBRARY_PATH environment variable before running the exeutable LD_LIBRARY_PATH=${PWD} ./app On Thursday, April 30, 2020 at 7:19:36 AM UTC+3, Dean Schulze wrote: > > I'm following a simple example >