Re: [go-nuts] Re: Go 1.18 Beta 1 is released

2021-12-16 Thread Ian Lance Taylor
On Thu, Dec 16, 2021 at 4:01 AM Jan Mercl <0xj...@gmail.com> wrote:
>
> On Tue, Dec 14, 2021 at 8:51 PM Cherry Mui  wrote:
>
> Let me report another failure that works, ie. tests build and pass,
> with Go1.17.5 but not with Go1.18beta1
>
> 
> jnml@darwin-m1:~$ GO111MODULE=off go get github.com/edsrzf/mmap-go
> jnml@darwin-m1:~$ cd edsrzf/mmap-go/
> /Users/jnml/src/github.com/edsrzf/mmap-go
> jnml@darwin-m1:~/src/github.com/edsrzf/mmap-go$ go test
> go: downloading golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6
> # golang.org/x/sys/unix
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:28:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:43:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:59:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:75:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:90:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:105:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:121:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:136:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:151:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:166:3:
> //go:linkname must refer to declared function or variable
> /Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:166:3:
> too many errors
> FAIL github.com/edsrzf/mmap-go [build failed]
> jnml@darwin-m1:~/src/github.com/edsrzf/mmap-go$ go version
> go version go1.18beta1 darwin/arm64
> jnml@darwin-m1:~/src/github.com/edsrzf/mmap-go$

There are no compatibility promises for unsupported techniques like
go:linkname.  If they update their copy of golang.org/x/sys, it will
work with Go1.18beta1.  I believe that this was fixed by
https://golang.org/cl/274573 which was committed to x/sys 2020-12-02.

Ian

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW_nkSNg4C40RLGndmYkMy6E8jHS-D-3h96VXD6WKYo5A%40mail.gmail.com.


Re: [go-nuts] Threats found on Win 10 21H1 64 bit computer

2021-12-16 Thread Ian Lance Taylor
On Thu, Dec 16, 2021 at 3:18 PM Robert Solomon  wrote:
>
> Since this is Windows Defender, the bug report would have to go to Microsoft.
> I've heard that they largely ignore such reports.
> So it goes.

Microsoft is a pretty big user of Go, so they might not ignore this
particular report.

Ian



> On Wednesday, December 15, 2021 at 9:13:12 PM UTC-5 Ian Lance Taylor wrote:
>>
>> On Wed, Dec 15, 2021 at 4:55 PM rob  wrote:
>> >
>> > I am compiling my own code using Go 1.17.5 (also happens w/ other versions)
>> >
>> > When I compile this code on my computer running win 10 21H1 64-bit
>> > system using "go install", the resulting exe file bothers windows
>> > anti-virus a lot. This is what I see
>> >
>> > Behavior:Win32/Execution.A!ml Severe
>> >
>> > And Windows deletes the file.
>> >
>> >
>> > I have discovered that if I compile using
>> >
>> > go install -ldflags="-s -w"
>> >
>> > Windows does not flag the exe file as dirty and delete it.
>> >
>> >
>> > Some of my code causes this when compiled, but most does not.
>> >
>> >
>> > Why is this happening? I don't think my Win 10 setup is so unusual.
>> > This has been happening for months; I saw this behavior also when
>> > compiling using earlier versions of Go 1.17, and also Go 1.16
>> >
>> > I don't remember it happening before Go 1.16
>>
>>
>> See https://go.dev/doc/faq#virus .
>>
>> Ian
>
> --
> 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 
> https://groups.google.com/d/msgid/golang-nuts/7520a65c-c341-43a7-ac5f-3172c7af6b30n%40googlegroups.com.

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUozbTfqsFM2EdPN-QfsK-KXTYbAhvjfqJPNrqj%2BPuK%3DA%40mail.gmail.com.


Re: [go-nuts] Threats found on Win 10 21H1 64 bit computer

2021-12-16 Thread Robert Solomon
Since this is Windows Defender, the bug report would have to go to 
Microsoft.  
I've heard that they largely ignore such reports.
So it goes.

Thanks for answering me, though.
--rob solomon

On Wednesday, December 15, 2021 at 9:13:12 PM UTC-5 Ian Lance Taylor wrote:

> On Wed, Dec 15, 2021 at 4:55 PM rob  wrote:
> >
> > I am compiling my own code using Go 1.17.5 (also happens w/ other 
> versions)
> >
> > When I compile this code on my computer running win 10 21H1 64-bit
> > system using "go install", the resulting exe file bothers windows
> > anti-virus a lot. This is what I see
> >
> > Behavior:Win32/Execution.A!ml Severe
> >
> > And Windows deletes the file.
> >
> >
> > I have discovered that if I compile using
> >
> > go install -ldflags="-s -w"
> >
> > Windows does not flag the exe file as dirty and delete it.
> >
> >
> > Some of my code causes this when compiled, but most does not.
> >
> >
> > Why is this happening? I don't think my Win 10 setup is so unusual.
> > This has been happening for months; I saw this behavior also when
> > compiling using earlier versions of Go 1.17, and also Go 1.16
> >
> > I don't remember it happening before Go 1.16
>
>
> See https://go.dev/doc/faq#virus .
>
> Ian
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/7520a65c-c341-43a7-ac5f-3172c7af6b30n%40googlegroups.com.


[go-nuts] Re: generics: Zero value for any type parameter

2021-12-16 Thread Johan Bolmsjö
torsdag 16 december 2021 kl. 23:40:09 UTC+1 skrev Johan Bolmsjö:

>
> My workaround has been to create a dummy variable, zeroValue in the 
> following example. I'm wondering if this is how to solve this problem or if 
> there is a better way.
>
>
I  realized I should have read the generics proposal before asking this 
question. My current workaround is mentioned together with some possible 
future improvements. At the time it seems to be idiomatic code. Sorry for 
the noise.
 

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/eebade7f-7168-458f-adcc-8cc4875a652en%40googlegroups.com.


[go-nuts] generics: Zero value for any type parameter

2021-12-16 Thread Johan Bolmsjö

Hello,

I've been playing with the new generics support in 1.18beta 1 today. I've 
come across a situation a couple of times where it would be convenient to 
be able to conjure the zero value for a variable corresponding to a type 
parameter.

I've searched a bit for this to no avail. Understandably there is not much 
information on this topic in the wild yet. I've found a couple of issues in 
the issue tracker like returning '_' to represent the zero value but this 
does not seem to be implemented.

My workaround has been to create a dummy variable, zeroValue in the 
following example. I'm wondering if this is how to solve this problem or if 
there is a better way.

// Remove mapping associated with key from tree. Returns the removed value 
and
// true or the zero value of V and false if there was no mapping.
func (tree *Tree[K, V]) Remove(key K) (V, bool) {
var zeroValue V
if tree.root == nil {
return zeroValue, false
}
...
}

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/7473-9570-440e-94d8-c7f7f1fa8926n%40googlegroups.com.


Re: [go-nuts] Help with GOLLVM

2021-12-16 Thread 'Than McIntosh' via golang-nuts
Greetings,

The code that Go compilers emit is closely tied to the Go runtime-- any
compiled Go code (including *.ll files) will have references to symbols
that it needs from the runtime. When you try to convert your LLVM-produced
bitcode into a binary via

clang helloworld.ll -o helloworldLLVM

you're effectively not including definitions of any of those key runtime
routines (for example, "runtime.newobject", which is one of the functions
that supports memory allocation).

It would be similar to what might happen if you took a C++ "hi mom"
program, compiled it down to an object file using "clang++", then tried to
link the resulting object into a binary using "gcc".

Hope this helps--

Than

On Thu, Dec 16, 2021 at 1:07 PM Danilo bestbug <
bestbug.corporat...@gmail.com> wrote:

> Hello,
>
> I've create a docker images with ubuntu 20.10 with GOLLVM, I'm using at
> the moment a simple test repository
> , I was able to create
> the ll file with the following command:
>
> go build -gccgoflags -static-libgo -x -work 1> transcript.txt 2>&1
> WORK=$(egrep -m 1 '(WORK=|llvm-goc -c)' transcript.txt | awk '{ print
> substr ($0, 6 ) }')
>
> /gollvm/install/bin/llvm-goc -c -O2 -g -m64
> -fdebug-prefix-map=$WORK=/tmp/go-build \
> -gno-record-gcc-switches -fgo-pkgpath=$PWD \
> -fgo-relative-import-path=$PWD -o $WORK/b001/_go_.o \
> -I $WORK/b001/_importcfgroot_ -o $LLFILE -S -emit-llvm $MAINFILE
>
> But when I try to convert to binary via clang the file I've some error:
> clang helloworld.ll -o helloworldLLVM
> warning: overriding the module target triple with x86_64-pc-linux-gnu
> [-Woverride-module]
> 1 warning generated.
> /usr/bin/ld:
> /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o:
> in function `_start':
> (.text+0x24): undefined reference to `main'
> /usr/bin/ld: /tmp/helloworld-bcb8cc.o: in function
> `_..z2fopt..z2fvmsdk..z2fhelloworld.describe':
> /opt/vmsdk/helloworld/./describe.go:6: undefined reference to
> `runtime.newobject'
> /usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to
> `runtime.writeBarrier'
> /usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to
> `fmt.Printf'
> /usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to
> `runtime.typedmemmove'
> /usr/bin/ld: /tmp/helloworld-bcb8cc.o:(.rodata.string..d[string..d]+0x18):
> undefined reference to `runtime.strequal..f'
> /usr/bin/ld:
> /tmp/helloworld-bcb8cc.o:(.rodata.type...1string[type...1string]+0x18):
> undefined reference to `runtime.memequal64..f'
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
>
> I'm this is the first time I use this buildchain and I don't understand
> what I'm doing wrong. Can someone help me?
> Those are the commit I've used for build gollvm, if needed
>
> llvm-project: 43ff75f2c3feef64f9d73328230d34dac8832a91
> llvm-project/llvm/tools/gollvm: 44a7a475cfd3b871b7a5a0941b8ab1ea9d489adc
> llvm-project/llvm/tools/gollvm/gofrontend:
> be0d2cc2df9f98d967c242594838f86362dae2e7
> llvm-project/llvm/tools/gollvm/libgo/libffi:
> 737d4faa00d681b4c758057f67e1a02d813d01c2
> llvm-project/llvm/tools/gollvm/libgo/libbacktrace:
> 5a99ff7fed66b8ea8f09c9805c138524a7035ece
>
> Thanks in advance!
>
> --
> 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
> https://groups.google.com/d/msgid/golang-nuts/d503d8bf-e904-42be-9955-6813d4f8c29fn%40googlegroups.com
> 
> .
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/CA%2BUr55EkHmiMhUXTWqWNY0bQOTzV6fkte-T5XieSWeQxnKJKsg%40mail.gmail.com.


[go-nuts] Re: generics: what can we do with an any type?

2021-12-16 Thread Howard C. Shaw III
The code you wrote is using a generic value, but it is not itself generic. 
There is only one instantiated version of the runInt() function, and it 
knows (at compile-time!) that mySet is an map[int]int.

Make that function actually generic - something like:
func testThing[K comparable, V any](m map[K]V) {
if m[1337] == 1337 {
print("OK")
} else {
print("nope")
}
}
and you get
./prog.go:xx:yy: cannot use 1337 (untyped int constant) as K value in map 
index 
./prog.go:xx:yy: cannot convert 1337 (untyped int constant) to V

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/e1f79d1d-3759-4fcc-a5a8-2d1e88599074n%40googlegroups.com.


[go-nuts] Re: generics: what can we do with an any type?

2021-12-16 Thread w54n
[]byte is a no comparable type.

quoting the docs:




*comparable is an interface that is implemented by all comparable 
types(booleans, numbers, strings, pointers, channels, interfaces,arrays of 
comparable types, structs whose fields are all comparable types).The 
comparable interface may only be used as a type parameter constraint,not as 
the type of a variable.*

for comparing bytes, use the "bytes" package.

here is an example from yours
https://go.dev/play/p/6PBnbGw-rVo?v=gotip

On Wednesday, December 15, 2021 at 5:39:39 PM UTC+1 Johannes Kohnen wrote:

> Hello folks, 
>
> I've stumbled over a thing and I don't understand if what I've found is 
> intentionally possible by design...
>
> https://go.dev/play/p/SIxOV1FnTzX?v=gotip 
>
> Why can I compare int with == when it was instantiated from the "any" type 
> parameter? 
>
> The origin of my question is my implementation of a left right map which 
> I've ported to generics.  While doing so I've uncovered a couple bugs in 
> Jetbrains GoLand and reported them.  Except this one, because I've 
> overlooked it and I now am confused:
>
>
> https://github.com/jwkohnen/lrmap/blob/a6b9a6715069a7ad24de7cf84fe949dd7f194c0a/lrmap_test.go#L26
>
> In this line I compare two int values with !=, and this code compiles. 
> Though, those value types were instantiated from the "any" type 
> constraint.  GoLand reports an error in that line "Invalid operation: _v != 
> v (the operator != is not defined on V)".
>
> From my reading of the generics proposal GoLand is right, but the compiler 
> says otherwise.  How exactly are the operations that are defined on an 
> "any" type inferred?
>
> Sorry if the answer is right there in the proposal; my reading 
> comprehension fluctuates wildly these days. 
>
> Cheers,
> Johannes
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/f0920648-a47a-45a6-8ab4-8943273efa54n%40googlegroups.com.


[go-nuts] Re: Java to Golang converter

2021-12-16 Thread alex-coder
The topic is very interesting, is anyone being worked on a subject ?
Thank you.

четверг, 11 мая 2017 г. в 21:19:13 UTC+3, dtr...@gmail.com: 

>
> Java has vast number of libraries.
>
> Good thing is Golang is catching up with its own style.
>
> There are cases though where there is no equivalent libraries ( PDF 
> reading / writing, TIFF reading writing, Office File formats)
>
> There were a few attempts for Java to Go conversions but not complete (if 
> ever can be complete).
>
> github.com/dglo/java2go (converter but not with UTF-8 capabilities)
>
> https://github.com/timob/javaparser (java parser)
>
> github.com/tinycedar/class-parser  (java class parser)
>
> github.com/tinylcy/SmallVM (Java VM interpreter)
>
> github.com/tinycedar/vanilla
>
> All of these projects show the need to read from Java.
>
> Is there any other project or effort to map java functions --> go or even 
> a decent converter?
>
> Any plans to make a decent converter from somebody?
>
>
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/626dd8a3-9014-4dbc-b0df-24407de7198en%40googlegroups.com.


[go-nuts] Re: [golang-dev] Methods may not take additional type arguments

2021-12-16 Thread 'Axel Wagner' via golang-nuts
[-golang-dev, +golang-nuts] The list you probably want is golang-nuts

This topic is discussed at some length in #49085
. Not, in particular, that this
option has been considered for the original design and it does not solve
all problems
.

On Thu, Dec 16, 2021 at 7:06 PM asv...@gmail.com  wrote:

> Maybe better allow methods to take type arguments but forbid type
> assertion when struct contains methods with type arguments?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-dev/eaac767c-db8d-420a-b647-8dc0504b8812n%40googlegroups.com
> 
> .
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfHu0wy5ofGQ6i3bX9h7qgX%3DFRATJfVWcDLD0Zt0LQ29Ww%40mail.gmail.com.


[go-nuts] Help with GOLLVM

2021-12-16 Thread Danilo bestbug
Hello,

I've create a docker images with ubuntu 20.10 with GOLLVM, I'm using at the 
moment a simple test repository 
, I was able to create the 
ll file with the following command:

go build -gccgoflags -static-libgo -x -work 1> transcript.txt 2>&1
WORK=$(egrep -m 1 '(WORK=|llvm-goc -c)' transcript.txt | awk '{ print 
substr ($0, 6 ) }')

/gollvm/install/bin/llvm-goc -c -O2 -g -m64 
-fdebug-prefix-map=$WORK=/tmp/go-build \
-gno-record-gcc-switches -fgo-pkgpath=$PWD \
-fgo-relative-import-path=$PWD -o $WORK/b001/_go_.o \
-I $WORK/b001/_importcfgroot_ -o $LLFILE -S -emit-llvm $MAINFILE

But when I try to convert to binary via clang the file I've some error:
clang helloworld.ll -o helloworldLLVM
warning: overriding the module target triple with x86_64-pc-linux-gnu 
[-Woverride-module]
1 warning generated.
/usr/bin/ld: 
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: 
in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/helloworld-bcb8cc.o: in function 
`_..z2fopt..z2fvmsdk..z2fhelloworld.describe':
/opt/vmsdk/helloworld/./describe.go:6: undefined reference to 
`runtime.newobject'
/usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to 
`runtime.writeBarrier'
/usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to 
`fmt.Printf'
/usr/bin/ld: /opt/vmsdk/helloworld/./describe.go:6: undefined reference to 
`runtime.typedmemmove'
/usr/bin/ld: /tmp/helloworld-bcb8cc.o:(.rodata.string..d[string..d]+0x18): 
undefined reference to `runtime.strequal..f'
/usr/bin/ld: 
/tmp/helloworld-bcb8cc.o:(.rodata.type...1string[type...1string]+0x18): 
undefined reference to `runtime.memequal64..f'
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)


I'm this is the first time I use this buildchain and I don't understand 
what I'm doing wrong. Can someone help me?
Those are the commit I've used for build gollvm, if needed

llvm-project: 43ff75f2c3feef64f9d73328230d34dac8832a91
llvm-project/llvm/tools/gollvm: 44a7a475cfd3b871b7a5a0941b8ab1ea9d489adc
llvm-project/llvm/tools/gollvm/gofrontend: 
be0d2cc2df9f98d967c242594838f86362dae2e7
llvm-project/llvm/tools/gollvm/libgo/libffi: 
737d4faa00d681b4c758057f67e1a02d813d01c2
llvm-project/llvm/tools/gollvm/libgo/libbacktrace: 
5a99ff7fed66b8ea8f09c9805c138524a7035ece

Thanks in advance!

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/d503d8bf-e904-42be-9955-6813d4f8c29fn%40googlegroups.com.


[go-nuts] Re: Go 1.18 Beta 1 is released

2021-12-16 Thread Jan Mercl
On Tue, Dec 14, 2021 at 8:51 PM Cherry Mui  wrote:

There's a test regression with Go1.18beta1 on freebsd/amd64 and
modernc.org/file.

The log file 
(https://gitlab.com/cznic/builder/-/blob/cdca564a0543e9ad0441884e3c12f7c0a326bdab/logs/freebsd64)
does not say much and I have not yet managed to look into the details:


I1215 17:27:15.3505301078 builder_test.go:583] Wed, 15 Dec 2021
17:27:15 CET: testing
modernc.org/file@14a2f19c5fb54a1264e8b2fa0e79b906349240af
I1215 17:27:15.3505781078 builder_test.go:609] dir
/home/jnml/src/modernc.org/builder/.exclude/src/modernc.org/file, cmd
[go test -timeout 24h]
E1215 17:32:17.8154391078 builder_test.go:501] dir
"/home/jnml/src/modernc.org/builder/.exclude/src/modernc.org/file",
argv0 "go", envExtra [], args ["test" "-timeout" "24h"], out
--- FAIL: TestCallocBigMap (3.04s)
all_test.go:1078: 161
FAIL
exit status 1
FAIL modernc.org/file 301.930s
E1215 17:32:17.8155161078 builder_test.go:503] FAIL: exit status 1
wd "/usr/home/jnml/src/modernc.org/builder/.exclude/src/modernc.org/file", 
E1215 17:32:17.8164811078 builder_test.go:612] FAIL testing modernc.org/file


https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2ffile
https://gitlab.com/cznic/builder/-/commit/cdca564a0543e9ad0441884e3c12f7c0a326bdab#cdf7e925f5746741c316f5fbcf39ad0dfca90775_88_87

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-VEBgAyDGKcnv9fU7R9JrECicXYH%2Bd3-oZ7fp92EH-jzg%40mail.gmail.com.


[go-nuts] Re: Go 1.18 Beta 1 is released

2021-12-16 Thread Jan Mercl
On Tue, Dec 14, 2021 at 8:51 PM Cherry Mui  wrote:

Let me report another failure that works, ie. tests build and pass,
with Go1.17.5 but not with Go1.18beta1


jnml@darwin-m1:~$ GO111MODULE=off go get github.com/edsrzf/mmap-go
jnml@darwin-m1:~$ cd edsrzf/mmap-go/
/Users/jnml/src/github.com/edsrzf/mmap-go
jnml@darwin-m1:~/src/github.com/edsrzf/mmap-go$ go test
go: downloading golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6
# golang.org/x/sys/unix
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:28:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:43:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:59:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:75:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:90:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:105:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:121:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:136:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:151:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:166:3:
//go:linkname must refer to declared function or variable
/Users/jnml/pkg/mod/golang.org/x/sys@v0.0.0-20181221143128-b4a75ba826a6/unix/zsyscall_darwin_arm64.go:166:3:
too many errors
FAIL github.com/edsrzf/mmap-go [build failed]
jnml@darwin-m1:~/src/github.com/edsrzf/mmap-go$ go version
go version go1.18beta1 darwin/arm64
jnml@darwin-m1:~/src/github.com/edsrzf/mmap-go$


PS: Going through the builders logs now, there might be more to report later.

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-UWdSb75W1Fw1_upS33dtWNG-OqOtykfVhFsWZKsZf2DQ%40mail.gmail.com.


Re: [go-nuts] go1.18 beta1: method instantiation accepts builtin types

2021-12-16 Thread Aliaksandr Mianzhynski
Ah, that makes sense, thanks.
> Perhaps it would be better to require the type-parameter names in method 
declarations to have the same names as in the type declaration.
I think this is something that linters should do one day.

On Thursday, December 16, 2021 at 12:39:44 PM UTC+3 
axel.wa...@googlemail.com wrote:

> It doesn't do "complete nonsense". It's equivalent to writing `func (r 
> Result[T])`, it just uses a different identifier for the type-parameter.
> I agree that this looks confusing, which is why you shouldn't do it. 
> Perhaps it would be better to require the type-parameter names in method 
> declarations to have the same names as in the type declaration. But note 
> that even that wouldn't prevent you from doing
>
> type Result[bool any] struct {}
>
> func (r Result[bool]) Method() { /* … */ }
>
> which still looks exactly as confusing.
>
> On Thu, Dec 16, 2021 at 10:24 AM Aliaksandr Mianzhynski <
> amenz...@gmail.com> wrote:
>
>> I'm a bit confused about ability to change struct constraints in methods 
>> that it looks like a method definition for a specific type, but in reality 
>> it does complete nonsense:
>>
>> Here's an example: https://gotipplay.golang.org/p/zFLJMdp5mbO
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/ad9317b8-aa69-4077-b24d-f6639eaf55e7n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/77758644-d686-4f98-b0f9-84037628ee60n%40googlegroups.com.


Re: [go-nuts] go1.18 beta1: method instantiation accepts builtin types

2021-12-16 Thread Brian Candler
> The second confusing part is that you can't instantiate a parameterized 
type in the way you might expect

I should have said "depending on the context, you can't *always* 
instantiate a parameterized type in the way you might expect".  This 
obviously does work:
r := Result[bool]{V: true}

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/e38d3d0f-5889-4c93-bfda-3d80c2656869n%40googlegroups.com.


Re: [go-nuts] go1.18 beta1: method instantiation accepts builtin types

2021-12-16 Thread Brian Candler
To me, the first confusing part is that in some places you need to write "T 
any" to accept any type (unconstrained), and in other places you can write 
bare "T"

The second confusing part is that you can't instantiate a parameterized 
type in the way you might expect, so in this case Result[bool] isn't a 
concrete type with the parameter set to "bool", but is really Result[T].  
You have to stamp out a new type:
https://gotipplay.golang.org/p/iYHguVsEEbZ   # gives the error the OP 
expected (perhaps)
https://gotipplay.golang.org/p/1fzwaoI7fyj   # fixed

The other potential source of confusion is that a type *parameter* can 
shadow the name of an existing defined type: so "bool" is still some type, 
but not the type it conventionally is. However, you can already do similar 
confusing things, like have a variable which shadows the name of a type:
https://go.dev/play/p/z6E5fm8x528

Or even directly shadow a built-in type:
https://go.dev/play/p/i7IB_nQdcFj

On Thursday, 16 December 2021 at 09:39:44 UTC axel.wa...@googlemail.com 
wrote:

> It doesn't do "complete nonsense". It's equivalent to writing `func (r 
> Result[T])`, it just uses a different identifier for the type-parameter.
> I agree that this looks confusing, which is why you shouldn't do it. 
> Perhaps it would be better to require the type-parameter names in method 
> declarations to have the same names as in the type declaration. But note 
> that even that wouldn't prevent you from doing
>
> type Result[bool any] struct {}
>
> func (r Result[bool]) Method() { /* … */ }
>
> which still looks exactly as confusing.
>
> On Thu, Dec 16, 2021 at 10:24 AM Aliaksandr Mianzhynski <
> amenz...@gmail.com> wrote:
>
>> I'm a bit confused about ability to change struct constraints in methods 
>> that it looks like a method definition for a specific type, but in reality 
>> it does complete nonsense:
>>
>> Here's an example: https://gotipplay.golang.org/p/zFLJMdp5mbO
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/ad9317b8-aa69-4077-b24d-f6639eaf55e7n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/c6956cf3-a782-423f-b4bc-3421f4f26551n%40googlegroups.com.


Re: [go-nuts] go1.18 beta1: method instantiation accepts builtin types

2021-12-16 Thread 'Axel Wagner' via golang-nuts
It doesn't do "complete nonsense". It's equivalent to writing `func (r
Result[T])`, it just uses a different identifier for the type-parameter.
I agree that this looks confusing, which is why you shouldn't do it.
Perhaps it would be better to require the type-parameter names in method
declarations to have the same names as in the type declaration. But note
that even that wouldn't prevent you from doing

type Result[bool any] struct {}

func (r Result[bool]) Method() { /* … */ }

which still looks exactly as confusing.

On Thu, Dec 16, 2021 at 10:24 AM Aliaksandr Mianzhynski <
amenzhin...@gmail.com> wrote:

> I'm a bit confused about ability to change struct constraints in methods
> that it looks like a method definition for a specific type, but in reality
> it does complete nonsense:
>
> Here's an example: https://gotipplay.golang.org/p/zFLJMdp5mbO
>
> --
> 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
> https://groups.google.com/d/msgid/golang-nuts/ad9317b8-aa69-4077-b24d-f6639eaf55e7n%40googlegroups.com
> 
> .
>

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfGDv9ibrb%2BfTAKK8h%3DOUXhRHx_G8idy_%2Bz6PVvr9p34bQ%40mail.gmail.com.


[go-nuts] go1.18 beta1: method instantiation accepts builtin types

2021-12-16 Thread Aliaksandr Mianzhynski
I'm a bit confused about ability to change struct constraints in methods 
that it looks like a method definition for a specific type, but in reality 
it does complete nonsense:

Here's an example: https://gotipplay.golang.org/p/zFLJMdp5mbO

-- 
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 
https://groups.google.com/d/msgid/golang-nuts/ad9317b8-aa69-4077-b24d-f6639eaf55e7n%40googlegroups.com.