Re: [go-nuts] Computing a hash over a uintptr ?

2021-06-03 Thread Ian Lance Taylor
On Thu, Jun 3, 2021 at 9:13 PM Robert Engels wrote: > > Doesn’t that depend on what the uintptr refers to? Eg if it was allocated off > heap to begin with then it should be stable and computing a hash on it is > valid. That is true in current implementations, but Go, the language, does not gua

Re: [go-nuts] Computing a hash over a uintptr ?

2021-06-03 Thread Robert Engels
Doesn’t that depend on what the uintptr refers to? Eg if it was allocated off heap to begin with then it should be stable and computing a hash on it is valid. > On Jun 3, 2021, at 9:42 AM, 'Axel Wagner' via golang-nuts > wrote: > >  >> On Thu, Jun 3, 2021 at 4:19 PM christoph...@gmail.com

[go-nuts] Go 1.16.5 and Go 1.15.13 are released

2021-06-03 Thread David Chase
Hello gophers, We have just released Go versions 1.16.5 and 1.15.13, minor point releases. These minor releases include security fixes according to the new security policy (#44918 ). The SetString and UnmarshalText methods of math/big.Rat

[go-nuts] Re: embedding files in tests

2021-06-03 Thread Manlio Perillo
Actually, if a file is embedded in the main package, go list will report it in the EmbedFiles field. If a file is embedded in a test, the -test flag is required because the test binary is required. Regards Manlio On Wednesday, June 2, 2021 at 5:56:42 PM UTC+2 peterGo wrote: > "it seems a bug .

[go-nuts] Fuzz testing is now beta ready!

2021-06-03 Thread Katie Hockman
Hi gophers! Native fuzzing is ready for beta testing in its development branch, dev.fuzz! Check out https://blog.golang.org/fuzz-beta for more details. Fuzzing is a type of automated testing which continuously manipulates inputs to a program to find issues such as panics or bugs. These semi-rando

[go-nuts] Re: Ignore /vendor by default in polyglot repository

2021-06-03 Thread Manlio Perillo
On Thursday, June 3, 2021 at 6:04:21 PM UTC+2 Jacob Vosmaer wrote: > Hi, > > In our organization we have a main code repository that contains > components written in different programming languages. One of these > components is written in Go. I would like to be able to have a single > go.mod fi

Re: [go-nuts] Golang calling Windows DLL function with more than 18 arguments

2021-06-03 Thread Ian Lance Taylor
On Thu, Jun 3, 2021 at 9:20 AM George Vanev wrote: > > The function is from a Chinese SDK and I don't have the source code: > int HDAPI Hd_Rt_SendRealTimeText(int nSendType, void *pStrParams, int > nRealTimeAreaIndex, int nMaxPageCount, int nColor, int nGray, int nX, int nY, > int nWidth, int n

Re: [go-nuts] Golang calling Windows DLL function with more than 18 arguments

2021-06-03 Thread George Vanev
The function is from a Chinese SDK and I don't have the source code: int HDAPI Hd_Rt_SendRealTimeText(int nSendType, void *pStrParams, int nRealTimeAreaIndex, int nMaxPageCount, int nColor, int nGray, int nX, int nY, int nWidth, int nHeight, void *pText, int nTextColor, int nBackGroupColor, int

Re: [go-nuts] Golang calling Windows DLL function with more than 18 arguments

2021-06-03 Thread Ian Lance Taylor
On Thu, Jun 3, 2021 at 8:42 AM George Vanev wrote: > > I have an external 64 bit .DLL and I have to pass 22 arguments to one of the > functions. Go (go1.16.4 windows/amd64) allows up to 18 arguments. Is there > any workaround? > I've tried to make Syscall22 in dll_windows.go, link it with > sys

[go-nuts] Ignore /vendor by default in polyglot repository

2021-06-03 Thread 'Jacob Vosmaer' via golang-nuts
Hi, In our organization we have a main code repository that contains components written in different programming languages. One of these components is written in Go. I would like to be able to have a single go.mod file for the whole repository, in the root directory. This doesn't work smoothly

[go-nuts] Golang calling Windows DLL function with more than 18 arguments

2021-06-03 Thread George Vanev
I have an external 64 bit .DLL and I have to pass 22 arguments to one of the functions. Go (go1.16.4 windows/amd64) allows up to 18 arguments. Is there any workaround? I've tried to make Syscall22 in dll_windows.go, link it with syscall_Syscall22 in src/runtime/syscall_windows.go and rebuilt: go

Re: [go-nuts] Re: Is this a bug ?

2021-06-03 Thread tapi...@gmail.com
Another runnable example: package main const x = 8 var y = 8 var a byte = 1 << x / 2 var b byte = 1 << y / 2 func main() { println(a) // 128 println(b) // 0 } On Thursday, June 3, 2021 at 10:42:32 AM UTC-4 peterGo wrote: > Jan, > > The untyped constant 1 assumes the type of x, which is fl

Re: [go-nuts] Re: Is this a bug ?

2021-06-03 Thread peterGo
Jan, The untyped constant 1 assumes the type of x, which is float64. With explicit types: package main import "fmt" func main() { var a int = 0 // invalid operation: float64(1) << a (shift of type float64) var x float64 = float64(1) << a fmt.Println(x) } https://play.golang.or

Re: [go-nuts] Computing a hash over a uintptr ?

2021-06-03 Thread 'Axel Wagner' via golang-nuts
On Thu, Jun 3, 2021 at 4:19 PM christoph...@gmail.com < christophe.mees...@gmail.com> wrote: > The documentation doesn’t specify that we can cast an uintptr into a > uint64. > Both are integer types, so they can be converted. You might be worried about their respective sizes and you are correct t

[go-nuts] Computing a hash over a uintptr ?

2021-06-03 Thread christoph...@gmail.com
The documentation specifies that a pointer can be cast into a uintptr integer. I assume that the uintptr is ignored by the garbage collector. I would like to compute a hash over the uintptr. How do I achieve that ? The documentation doesn’t specify that we can cast an uintptr into a uint64. T

Re: [go-nuts] Re: Is this a bug ?

2021-06-03 Thread 'Axel Wagner' via golang-nuts
It is not a bug. The spec says : If the left operand of a *constant *shift expression is an untyped > constant, the result is an integer constant; otherwise it is a constant of > the same type as the left operand, which must be of integer type.

Re: [go-nuts] Re: Is this a bug ?

2021-06-03 Thread Jan Mercl
On Thu, Jun 3, 2021 at 11:21 AM Brian Candler wrote: > > Weird. It simplifies to this: https://play.golang.org/p/OsOhRMC6kBu I think this case is WAI. >From https://golang.org/ref/spec#Operators " If the left operand of a non-constant shift expression is an untyped constant, it is first implic

[go-nuts] Re: Is this a bug ?

2021-06-03 Thread Brian Candler
Weird. It simplifies to this: https://play.golang.org/p/OsOhRMC6kBu On Thursday, 3 June 2021 at 10:08:22 UTC+1 Jamil Djadala wrote: > > https://groups.google.com/g/golang-nuts > > package main > > import ( > "fmt" > ) > > func main() { > const aa int = 0 > var a int > fmt.Println

[go-nuts] Is this a bug ?

2021-06-03 Thread Jamil Djadala
https://groups.google.com/g/golang-nuts package main import ( "fmt" ) func main() { const aa int = 0 var a int fmt.Println(float64(1

[go-nuts] Re: json unmarshalling troubles

2021-06-03 Thread natxo....@gmail.com
hi all, thanks for your insights. The Value interface{} type does work nicely. I had tried as well the map[string]interface{} route, and it works as well, so now I have two solutions which is kind of a luxury position. Regards, Natxo On Thursday, June 3, 2021 at 7:41:21 AM UTC+2 Amnon wrote