Re: [go-nuts] Can I play with go1.18 beta while keeping my stable 1.17 version around for production code?

2021-12-15 Thread fgergo
Sure:
https://go.dev/doc/manage-install#installing-multiple



On 12/15/21, Travis Keep  wrote:
> This may be silly question, but is there a way for me to download and play
> with 1.18 while keeping my existing 1.17 installation for production code?
>
> Is there a way to have multiple versions of go installed on the same
> computer?
>
> --
> 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/d4b079cb-4830-4103-8267-7787294af8b2n%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%2BctqrpT7pXRZJaUdXcMgJwCM%2BPOsW5oqyyNxbiy5Svz1VAhbA%40mail.gmail.com.


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

2021-12-15 Thread Ian Lance Taylor
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/CAOyqgcXqMm9hSf79WueHC5pR7_R0R-pwWzQp-cyhdmReU6UGrQ%40mail.gmail.com.


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

2021-12-15 Thread rob

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

--rob solomon


--
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/c2a0c626-ec70-f797-d37f-1970c18ea8f7%40gmail.com.


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

2021-12-15 Thread Brian Candler
NewThing[int, int]()  returns  a map[int]int, and therefore that's the type 
of MySet in func runInt.

You can think of NewThing[T1, T2] as a family of functions, like

func NewThing_int_int() map[int]int { ... }
func NewThing_int_byteslice() map[int][]byte { ... }
... etc

On Wednesday, 15 December 2021 at 17:01:41 UTC seank...@gmail.com wrote:

> when writing type parameterized code, it has to work with anything that 
> could be passed to it.
> but once instantiated, the type is known and it can be used with its 
> concrete type
>
> like `map` can be thought of as  declared to be `map[comparable]any`
> but when you use it, the type is always known, eg. `map[string]int`
> 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/efea2fcc-c0cc-4228-9f81-36b0435c4c8bn%40googlegroups.com.


[go-nuts] Bend time to your will and make your gray-t escape in MONOVANIA (powered by Ebiten)

2021-12-15 Thread Trevor Slocum
MONOVANIA[0] was created for the Metroidvania Month 14 game jam.[1]  Its 
source code is freely available.[2]

Players start the game with the ability to rewind time.

The objective of MONOVANIA is to collect the three exit keys and make your 
gray-t escape.

What is a Metroidvania video game?
> Metroidvania is a subgenre of action-adventure video games focused on 
guided non-linearity and utility-gated exploration and progression. The 
term is a portmanteau of the names of the video game series Metroid and 
Castlevania, with games in the genre borrowing from both series.
-Wikipedia


0. https://itch.io/jam/metroidvania-month-14/rate/1300904
1. https://itch.io/jam/metroidvania-month-14/entries
2. https://code.rocketnine.space/tslocum/monovania

-- 
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/ab262b0b-3de0-4c22-9931-74549f18f8cfn%40googlegroups.com.


Re: [go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Ian Lance Taylor
On Wed, Dec 15, 2021 at 3:24 AM Leonard Mittmann
 wrote:
>
> I just learned that type constraints, which are defined as interfaces are 
> actually not usable in all the places "normal" interfaces can be used in. 
> E.g., why can a constraint interface not be uses as a struct type?
>
> Let's say I have the func `func Smallest[T constraints.Ordered](s []T) T`. 
> How do I write a table test for this func? Intuitively one would try to store 
> tests like this:
>
> tests := []struct {
> Arr: []constraints.Ordered
> Want: constraints.Ordered
> }{...}
>
> But this is not permitted. Am I missing something why this behavior is should 
> be considered good? If a type constraint is nothing like an interface... 
> okay, but why call it interface then?

Aside from the rest of the conversation, note that your suggestion is
never going to work, because you aren't going to be able to write the
next steps in which you try to instantiate a function with an element
of a slice.  You can only instantiate functions with types known at
compile time, not with types known at run time.

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/CAOyqgcUyeZq9HBw6DyEZ7dL2U6mv6YQPFM%3DaKR-zZOnk6L6W4w%40mail.gmail.com.


Re: [go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Ian Lance Taylor
On Wed, Dec 15, 2021 at 8:29 AM Brian Hatfield  wrote:
>
> I read that and I genuinely do not understand why interfaces now mean two 
> distinct incompatible things. I think this is going to confuse a lot of 
> people.

This is perhaps pedantic, but the two meanings are not incompatible.
The set of interface types that may be used as the types of a variable
are a strict subset of the set of interface types that may be used as
constraints.  What is new in 1.18 (among other things) is that it is
now possible to write an interface type that may not be used as the
type of a variable.  This is a loss of orthogonality but it doesn't
mean that interface types mean two different things.

It is possible that in the future we will permit variables to have
interface types that use embedded non-interface types, approximation
elements, and union elements.  That would be a significant change to
the language and we've chosen to separate that change from the complex
addition of generic support.  And we may never make that change.  We
don't know yet.

Ian


> On Wed, Dec 15, 2021 at 11:09 AM Jason Phillips  
> wrote:
>>
>> As to _why_ this is the case, the generics proposal has a section about that:
>> https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#permitting-constraints-as-ordinary-interface-types
>>
>> On Wednesday, December 15, 2021 at 11:05:36 AM UTC-5 Jason Phillips wrote:
>>>
>>> @Leonard, type constraints can only be used as type parameters, using them 
>>> as normal interfaces is currently not allowed. See the notes in the draft 
>>> release notes[1] or the draft 1.18 spec[2].
>>>
>>> > Such interfaces may only be used as type constraints.
>>>
>>> > Interfaces that contain non-interface types, terms of the form ~T, or 
>>> > unions may only be used as type constraints, or as elements of other 
>>> > interfaces used as constraints. They cannot be the types of values or 
>>> > variables, or components of other, non-interface types.
>>>
>>> @Kurtis, that issue is about embedded fields (fields without explicit field 
>>> names) that use type parameters.
>>>
>>> [1] - https://tip.golang.org/doc/go1.18
>>> [2] - https://tip.golang.org/ref/spec#Interface_types
>>>
>>> On Wednesday, December 15, 2021 at 10:47:20 AM UTC-5 kra...@skepticism.us 
>>> wrote:

 This was asked 15 hours ago in the thread with the subject line "Go 1.18 
 beta1: Embedding Type Parameter in struct definition is an error". :-)

 See https://golang.org/issue/49030.

 On Wed, Dec 15, 2021 at 3:24 AM Leonard Mittmann  
 wrote:
>
> I just learned that type constraints, which are defined as interfaces are 
> actually not usable in all the places "normal" interfaces can be used in. 
> E.g., why can a constraint interface not be uses as a struct type?
>
> Let's say I have the func `func Smallest[T constraints.Ordered](s []T) 
> T`. How do I write a table test for this func? Intuitively one would try 
> to store tests like this:
>
> tests := []struct {
> Arr: []constraints.Ordered
> Want: constraints.Ordered
> }{...}
>
> But this is not permitted. Am I missing something why this behavior is 
> should be considered good? If a type constraint is nothing like an 
> interface... okay, but why call it interface then?
>
> --
> 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/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com.



 --
 Kurtis Rader
 Caretaker of the exceptional canines Junior and Hank
>>
>> --
>> 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/0ae9aed8-72d4-42a2-acf0-16d0bd6b08ecn%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/CANGiwgY2%2B-xEBzezeh-D_0dv2hQXreWLsiXoOSP%2Bw-LUV%3DkVaw%40mail.gmail.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/CAOyqgc

[go-nuts] Introducing TimeMate - How to make time & microservices work for you with Golang and GRPC

2021-12-15 Thread X Technology
Have you ever heard of a Pomodoro technique? 🍅  It helps stay in the flow 
and focused even when activities are overwhelming. We believe that everyone 
has it's own time management style and it's just a matter of time to find a 
right tracker. Maybe a better idea, to write a new one!

This time we meet on Saturday, 18th of December at 10am CET, last time this 
year to pitch Andrew Reddikh project TimeMate. This is a demo project to 
automate daily routines of a consultancy agent (developer) to
- track time over different platform, which you're comfortable with
- synchronise tracked time entries with customer's software, e.g. Jira, 
YouTrack
- create regular (monthly, weekly) time reports
- create regular invoices (monthly, weekly)
- send reports/invoices over various of channels

We are going to overview the basics of microservices world with Golang. We 
plan to 
discuss GRPC protocol, draw a design for the ideal pluggable architecture, 
think of interfaces and plugins to extend the tracking service, pick a 
module system to use native golang plugins or RPC plugins, prototype CI/CD 
workflow for cloud providers (hashicorp). 

Join us: 
https://www.eventbrite.com/e/how-to-make-time-microservices-work-for-you-with-golang-and-grpc-tickets-227319457617?aff=ebdssbonlinesearch&keep_tld=1

---
Follow us on:
- Twitter https://twitter.com/XTechnology5
- Telegram https://t.me/xtechn
- Eventbrite https://www.eventbrite.com/organizati...
- Github https://github.com/x-technology

-- 
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/a3ff0218-507a-4348-8736-dbcdc033af50n%40googlegroups.com.


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

2021-12-15 Thread Jan Mercl
On Wed, Dec 15, 2021 at 7:41 PM Austin Clements  wrote:

> Jan, assuming you're running on an AMD CPU, this is go.dev/issue/34988 (if 
> you're not running on an AMD CPU, that would be very interesting to know!) 
> The TL;DR is that this appears to be a kernel bug, and we have a C 
> reproducer, but we do not yet have a fix or a workaround.

Yep, the qemu host in question was running on an AMD Ryzen 9 3900X.

-- 
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-UqjAz2bA7LkGkshVQ-pEQtM2D9AvOmH%3DYBWhbtRdTnxA%40mail.gmail.com.


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

2021-12-15 Thread 'Austin Clements' via golang-nuts
Jan, assuming you're running on an AMD CPU, this is go.dev/issue/34988 (if
you're not running on an AMD CPU, that would be very interesting to know!)
The TL;DR is that this appears to be a kernel bug, and we have a C
reproducer, but we do not yet have a fix or a workaround.


On Wed, Dec 15, 2021 at 7:57 AM Jan Mercl <0xj...@gmail.com> wrote:

> On Tue, Dec 14, 2021 at 8:51 PM Cherry Mui  wrote:
>
> > We have just released go1.18beta1, a beta version of Go 1.18.
> > It is cut from the master branch at the revision tagged go1.18beta1.
> >
> > Please try your production load tests and unit tests with the new
> version.
> > Your help testing these pre-release versions is invaluable.
> >
> > Report any problems using the issue tracker:
> > https://golang.org/issue/new
>
> The link requires a Github account, which I don't have so instead
> reporting here:
>
> When trying to build from source on netbsd/amd64 in qemu, both
> 'all.bash' and 'make.bash' crashes, logs attached. FYI, with Go1.17.5
> and the same qemu VM, 'all.bash' fails, but does not crash IIRC and
> 'make.bash' completes without issues.
>
> -j
>
> --
> 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-UsTmUHXa-ao%3DykO9ejG-J8OD8scdmKiQtoxC2npC4HOg%40mail.gmail.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/CALgmw1-p0wSuBQt2hatAGEb%2BcgK9ezU%2BGW6HpK%2BV1R69x%3DeV2A%40mail.gmail.com.


Re: [go-nuts] Can I play with go1.18 beta while keeping my stable 1.17 version around for production code?

2021-12-15 Thread Brian Hatfield
Yes! If you see the release email, there's some steps included:

If you have Go installed already, the easiest way to try go1.18beta1
is by using the go command:
$ go install golang.org/dl/go1.18beta1@latest
$ go1.18beta1 download

On Wed, Dec 15, 2021 at 12:03 PM Travis Keep  wrote:

> This may be silly question, but is there a way for me to download and play
> with 1.18 while keeping my existing 1.17 installation for production code?
> Is there a way to have multiple versions of go installed on the same
> computer?
>
> --
> 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/d4b079cb-4830-4103-8267-7787294af8b2n%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/CANGiwgZaOC4EqBj0OhG9-NVEYAJRGM_dqma4nu2aTYWTdjZ%3DQg%40mail.gmail.com.


Re: [go-nuts] Can I play with go1.18 beta while keeping my stable 1.17 version around for production code?

2021-12-15 Thread Bruno Albuquerque
Yes, see instructions on how to download/install go1.18beta1. It
explicitly suggests a way that will allow this.


On Wed, Dec 15, 2021 at 9:03 AM Travis Keep  wrote:

> This may be silly question, but is there a way for me to download and play
> with 1.18 while keeping my existing 1.17 installation for production code?
> Is there a way to have multiple versions of go installed on the same
> computer?
>
> --
> 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/d4b079cb-4830-4103-8267-7787294af8b2n%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/CAEd86Tz-_6AQhJCfTtatqRnJpX%3DrMXVGEbVR5tN6j4%3DMu3Yqqg%40mail.gmail.com.


[go-nuts] Hiring Go Lang Developers - Spenmo (Leading Fintech)

2021-12-15 Thread Daily Job Alert
Spenmo hiring Engineers for below job roles from Fintech or B2B Startup or
Product based companies.

*Job 1: Golang Developer (Backend)*

Experience: 3 - 5 years
Prog Lang : Golang Must,Laravel (advantage)
Frame Work: Unit, Integration and E2E test
Design Pattern : REST, Pub/Sub
Preferable Skills: AWS Cloud and gRPC Open Source

*Apply Now: *https://forms.gle/hJLYVtDqBJX6LG6AA

*Job 2: Golang Development Lead (Backend)*

Experience: 6 - 8 years
Prog Lang : Golang Must,Laravel (advantage)
Frame Work: Unit, Integration and E2E test
Design Pattern : REST, Pub/Sub
SEDC: Agile and Scrum
Quality Tools: Jaeger/Datadog
Databases: SQL or NoSQL
Preferable Skills: AWS Cloud and gRPC Open Source

*Apply Now:* https://forms.gle/hJLYVtDqBJX6LG6AA

-- 
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/CAOvxG6noguPsfPdXrBO0ASmhSbmu3ae5gpxPHnW-NRp-F5hR7g%40mail.gmail.com.


[go-nuts] Can I play with go1.18 beta while keeping my stable 1.17 version around for production code?

2021-12-15 Thread Travis Keep
This may be silly question, but is there a way for me to download and play 
with 1.18 while keeping my existing 1.17 installation for production code?  
Is there a way to have multiple versions of go installed on the same 
computer?

-- 
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/d4b079cb-4830-4103-8267-7787294af8b2n%40googlegroups.com.


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

2021-12-15 Thread Sean Liao
when writing type parameterized code, it has to work with anything that 
could be passed to it.
but once instantiated, the type is known and it can be used with its 
concrete type

like `map` can be thought of as  declared to be `map[comparable]any`
but when you use it, the type is always known, eg. `map[string]int`
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/721e2328-e7ab-48a8-80fc-bf11a783d187n%40googlegroups.com.


Re: [go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Brian Candler
A function which takes a value of an interface type, and a function which 
takes a value of a constrained generic type, are certainly two different 
things.

In the first case, it gets a dynamic boxed value which at runtime may 
contain a value of any type that implements that interface - or no value at 
all (nil interface value).

In the second case, it gets a static value of a concrete type, where the 
type is fixed at compile time.  The programmer may choose any type which 
meets the constraint.  The compiler may emit multiple versions of the same 
function, specialised to each type used, if it so chooses.

On Wednesday, 15 December 2021 at 16:29:55 UTC bmhat...@gmail.com wrote:

> I read that and I genuinely do not understand why interfaces now mean two 
> distinct incompatible things. I think this is going to confuse a lot of 
> people.
>
> On Wed, Dec 15, 2021 at 11:09 AM Jason Phillips  
> wrote:
>
>> As to _why_ this is the case, the generics proposal has a section about 
>> that:
>>
>> https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#permitting-constraints-as-ordinary-interface-types
>>
>> On Wednesday, December 15, 2021 at 11:05:36 AM UTC-5 Jason Phillips wrote:
>>
>>> @Leonard, type constraints can only be used as type parameters, using 
>>> them as normal interfaces is currently not allowed. See the notes in the 
>>> draft release notes[1] or the draft 1.18 spec[2].
>>>
>>> > Such interfaces may only be used as type constraints.
>>>
>>> > Interfaces that contain non-interface types, terms of the form ~T, or 
>>> unions may only be used as type constraints, or as elements of other 
>>> interfaces used as constraints. They cannot be the types of values or 
>>> variables, or components of other, non-interface types.
>>>
>>> @Kurtis, that issue is about embedded fields (fields without explicit 
>>> field names) that use type parameters.
>>>
>>> [1] - https://tip.golang.org/doc/go1.18
>>> [2] - https://tip.golang.org/ref/spec#Interface_types
>>>
>>> On Wednesday, December 15, 2021 at 10:47:20 AM UTC-5 
>>> kra...@skepticism.us wrote:
>>>
 This was asked 15 hours ago in the thread with the subject line "Go 
 1.18 beta1: Embedding Type Parameter in struct definition is an error". :-)

 See https://golang.org/issue/49030.

 On Wed, Dec 15, 2021 at 3:24 AM Leonard Mittmann  
 wrote:

> I just learned that type constraints, which are defined as interfaces 
> are actually not usable in all the places "normal" interfaces can be used 
> in. E.g., why can a constraint interface not be uses as a struct type?
>
> Let's say I have the func `func Smallest[T constraints.Ordered](s 
> []T) T`. How do I write a table test for this func? Intuitively one 
> would try to store tests like this:
>
> tests := []struct {
> Arr: []constraints.Ordered
> Want: constraints.Ordered
> }{...}
>
> But this is not permitted. Am I missing something why this behavior is 
> should be considered good? If a type constraint is nothing like an 
> interface... okay, but why call it interface then?
>
> -- 
> 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/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com
>  
> 
> .
>


 -- 
 Kurtis Rader
 Caretaker of the exceptional canines Junior and Hank

>>> -- 
>> 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/0ae9aed8-72d4-42a2-acf0-16d0bd6b08ecn%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/e827b055-306d-4eee-b2e4-b27312bb36a8n%40googlegroups.com.


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

2021-12-15 Thread 'Johannes Kohnen' via golang-nuts
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/CA%2B5f5upYHUvABKSJhtdQL-qRg6FKhg-N7c9433zv%2BTXbteT93Q%40mail.gmail.com.


Re: [go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Brian Hatfield
I read that and I genuinely do not understand why interfaces now mean two
distinct incompatible things. I think this is going to confuse a lot of
people.

On Wed, Dec 15, 2021 at 11:09 AM Jason Phillips 
wrote:

> As to _why_ this is the case, the generics proposal has a section about
> that:
>
> https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#permitting-constraints-as-ordinary-interface-types
>
> On Wednesday, December 15, 2021 at 11:05:36 AM UTC-5 Jason Phillips wrote:
>
>> @Leonard, type constraints can only be used as type parameters, using
>> them as normal interfaces is currently not allowed. See the notes in the
>> draft release notes[1] or the draft 1.18 spec[2].
>>
>> > Such interfaces may only be used as type constraints.
>>
>> > Interfaces that contain non-interface types, terms of the form ~T, or
>> unions may only be used as type constraints, or as elements of other
>> interfaces used as constraints. They cannot be the types of values or
>> variables, or components of other, non-interface types.
>>
>> @Kurtis, that issue is about embedded fields (fields without explicit
>> field names) that use type parameters.
>>
>> [1] - https://tip.golang.org/doc/go1.18
>> [2] - https://tip.golang.org/ref/spec#Interface_types
>>
>> On Wednesday, December 15, 2021 at 10:47:20 AM UTC-5 kra...@skepticism.us
>> wrote:
>>
>>> This was asked 15 hours ago in the thread with the subject line "Go 1.18
>>> beta1: Embedding Type Parameter in struct definition is an error". :-)
>>>
>>> See https://golang.org/issue/49030.
>>>
>>> On Wed, Dec 15, 2021 at 3:24 AM Leonard Mittmann 
>>> wrote:
>>>
 I just learned that type constraints, which are defined as interfaces
 are actually not usable in all the places "normal" interfaces can be used
 in. E.g., why can a constraint interface not be uses as a struct type?

 Let's say I have the func `func Smallest[T constraints.Ordered](s []T)
 T`. How do I write a table test for this func? Intuitively one would
 try to store tests like this:

 tests := []struct {
 Arr: []constraints.Ordered
 Want: constraints.Ordered
 }{...}

 But this is not permitted. Am I missing something why this behavior is
 should be considered good? If a type constraint is nothing like an
 interface... okay, but why call it interface then?

 --
 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/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com
 
 .

>>>
>>>
>>> --
>>> Kurtis Rader
>>> Caretaker of the exceptional canines Junior and Hank
>>>
>> --
> 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/0ae9aed8-72d4-42a2-acf0-16d0bd6b08ecn%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/CANGiwgY2%2B-xEBzezeh-D_0dv2hQXreWLsiXoOSP%2Bw-LUV%3DkVaw%40mail.gmail.com.


Re: [go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Jason Phillips
As to _why_ this is the case, the generics proposal has a section about 
that:
https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#permitting-constraints-as-ordinary-interface-types

On Wednesday, December 15, 2021 at 11:05:36 AM UTC-5 Jason Phillips wrote:

> @Leonard, type constraints can only be used as type parameters, using them 
> as normal interfaces is currently not allowed. See the notes in the draft 
> release notes[1] or the draft 1.18 spec[2].
>
> > Such interfaces may only be used as type constraints.
>
> > Interfaces that contain non-interface types, terms of the form ~T, or 
> unions may only be used as type constraints, or as elements of other 
> interfaces used as constraints. They cannot be the types of values or 
> variables, or components of other, non-interface types.
>
> @Kurtis, that issue is about embedded fields (fields without explicit 
> field names) that use type parameters.
>
> [1] - https://tip.golang.org/doc/go1.18
> [2] - https://tip.golang.org/ref/spec#Interface_types
>
> On Wednesday, December 15, 2021 at 10:47:20 AM UTC-5 kra...@skepticism.us 
> wrote:
>
>> This was asked 15 hours ago in the thread with the subject line "Go 1.18 
>> beta1: Embedding Type Parameter in struct definition is an error". :-)
>>
>> See https://golang.org/issue/49030.
>>
>> On Wed, Dec 15, 2021 at 3:24 AM Leonard Mittmann  
>> wrote:
>>
>>> I just learned that type constraints, which are defined as interfaces 
>>> are actually not usable in all the places "normal" interfaces can be used 
>>> in. E.g., why can a constraint interface not be uses as a struct type?
>>>
>>> Let's say I have the func `func Smallest[T constraints.Ordered](s []T) T`. 
>>> How do I write a table test for this func? Intuitively one would try to 
>>> store tests like this:
>>>
>>> tests := []struct {
>>> Arr: []constraints.Ordered
>>> Want: constraints.Ordered
>>> }{...}
>>>
>>> But this is not permitted. Am I missing something why this behavior is 
>>> should be considered good? If a type constraint is nothing like an 
>>> interface... okay, but why call it interface then?
>>>
>>> -- 
>>> 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/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>
>>
>> -- 
>> Kurtis Rader
>> Caretaker of the exceptional canines Junior and Hank
>>
>

-- 
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/0ae9aed8-72d4-42a2-acf0-16d0bd6b08ecn%40googlegroups.com.


Re: [go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Jason Phillips
@Leonard, type constraints can only be used as type parameters, using them 
as normal interfaces is currently not allowed. See the notes in the draft 
release notes[1] or the draft 1.18 spec[2].

> Such interfaces may only be used as type constraints.

> Interfaces that contain non-interface types, terms of the form ~T, or 
unions may only be used as type constraints, or as elements of other 
interfaces used as constraints. They cannot be the types of values or 
variables, or components of other, non-interface types.

@Kurtis, that issue is about embedded fields (fields without explicit field 
names) that use type parameters.

[1] - https://tip.golang.org/doc/go1.18
[2] - https://tip.golang.org/ref/spec#Interface_types

On Wednesday, December 15, 2021 at 10:47:20 AM UTC-5 kra...@skepticism.us 
wrote:

> This was asked 15 hours ago in the thread with the subject line "Go 1.18 
> beta1: Embedding Type Parameter in struct definition is an error". :-)
>
> See https://golang.org/issue/49030.
>
> On Wed, Dec 15, 2021 at 3:24 AM Leonard Mittmann  
> wrote:
>
>> I just learned that type constraints, which are defined as interfaces are 
>> actually not usable in all the places "normal" interfaces can be used in. 
>> E.g., why can a constraint interface not be uses as a struct type?
>>
>> Let's say I have the func `func Smallest[T constraints.Ordered](s []T) T`. 
>> How do I write a table test for this func? Intuitively one would try to 
>> store tests like this:
>>
>> tests := []struct {
>> Arr: []constraints.Ordered
>> Want: constraints.Ordered
>> }{...}
>>
>> But this is not permitted. Am I missing something why this behavior is 
>> should be considered good? If a type constraint is nothing like an 
>> interface... okay, but why call it interface then?
>>
>> -- 
>> 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/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
>

-- 
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/e0c12926-4b5e-45ac-b9a8-409e1657fa42n%40googlegroups.com.


Re: [go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Kurtis Rader
This was asked 15 hours ago in the thread with the subject line "Go 1.18
beta1: Embedding Type Parameter in struct definition is an error". :-)

See https://golang.org/issue/49030.

On Wed, Dec 15, 2021 at 3:24 AM Leonard Mittmann 
wrote:

> I just learned that type constraints, which are defined as interfaces are
> actually not usable in all the places "normal" interfaces can be used in.
> E.g., why can a constraint interface not be uses as a struct type?
>
> Let's say I have the func `func Smallest[T constraints.Ordered](s []T) T`.
> How do I write a table test for this func? Intuitively one would try to
> store tests like this:
>
> tests := []struct {
> Arr: []constraints.Ordered
> Want: constraints.Ordered
> }{...}
>
> But this is not permitted. Am I missing something why this behavior is
> should be considered good? If a type constraint is nothing like an
> interface... okay, but why call it interface then?
>
> --
> 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/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com
> 
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
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/CABx2%3DD_nd3yd429Tetf1ZZYM9suLhobKwCuEsxijxk_2ofNZ_w%40mail.gmail.com.


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

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

> We have just released go1.18beta1, a beta version of Go 1.18.
> It is cut from the master branch at the revision tagged go1.18beta1.
>
> Please try your production load tests and unit tests with the new version.
> Your help testing these pre-release versions is invaluable.
>
> Report any problems using the issue tracker:
> https://golang.org/issue/new

The link requires a Github account, which I don't have so instead
reporting here:

When trying to build from source on netbsd/amd64 in qemu, both
'all.bash' and 'make.bash' crashes, logs attached. FYI, with Go1.17.5
and the same qemu VM, 'all.bash' fails, but does not crash IIRC and
'make.bash' completes without issues.

-j

-- 
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-UsTmUHXa-ao%3DykO9ejG-J8OD8scdmKiQtoxC2npC4HOg%40mail.gmail.com.


log.tar.gz
Description: application/gzip


Re: [go-nuts] Memory usage

2021-12-15 Thread Gareth Owenson
Thanks both, immensely helpful in narrowing the problem.


On Tue, Dec 14, 2021 at 7:12 AM Miha Vrhovnik 
wrote:

> And if you are using a cgo and didn't replace the standard malloc with
> jemaloc you are probably suffering from memory fragmentation or whatever
> the hell happens.
> We had to restart the processors every 1000 iterations because of that.
> There was no memory leak according to valgrind. (about 300kb), yet the RSS
> was constantly rising. Calling exactly the same C api with a C shim the RSS
> was constant about 100M. And api was extremely simplified all large memory
> allocations happened on the C side. pprof showed small amount of used
> memory yet the RSS was in gigabytes.
>
>
> BR;
> Miha
> On Monday, December 13, 2021 at 7:24:57 PM UTC+1 kra...@skepticism.us
> wrote:
>
>> If you're using cgo to link with C/C++ code then a memory leak in that
>> API is the first place to start looking..
>>
>> On Mon, Dec 13, 2021 at 10:14 AM Gareth Owenson 
>> wrote:
>>
>>> Hi all
>>>
>>> We have a go application that processes large numbers of documents.  It
>>> behaves like it has a memory leak, eventually exhausting system ram after a
>>> few hours.  I've setup pprof and looked at the various outputs, and that is
>>> adamant that the application is only using some 50MB of ram, yet Linux top
>>> reports it using much more (and growing).
>>>
>>> I've tried setting madvdontneed to no avail.
>>>
>>> Any help on better ways to identify the cause would be greatly
>>> appreciated.
>>>
>>> best
>>> Gareth
>>>
>>> --
>>> 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/409a950d-b270-4ef7-a965-ea3d450e74f5n%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Kurtis Rader
>> Caretaker of the exceptional canines Junior and Hank
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/lGcsCbY282I/unsubscribe.
> To unsubscribe from this group and all its topics, 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/0707e376-d6d7-40ff-9803-e5534c98b62dn%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/CALjXe529FreQk9eWddEGkCAmU1aKrrEuhPux22gJ1tNNxj%3DNcg%40mail.gmail.com.


[go-nuts] Go 1.18. Type Constraints are (not) interfaces!?

2021-12-15 Thread Leonard Mittmann
I just learned that type constraints, which are defined as interfaces are 
actually not usable in all the places "normal" interfaces can be used in. 
E.g., why can a constraint interface not be uses as a struct type?

Let's say I have the func `func Smallest[T constraints.Ordered](s []T) T`. 
How do I write a table test for this func? Intuitively one would try to 
store tests like this:

tests := []struct {
Arr: []constraints.Ordered
Want: constraints.Ordered
}{...}

But this is not permitted. Am I missing something why this behavior is 
should be considered good? If a type constraint is nothing like an 
interface... okay, but why call it interface then?

-- 
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/53df110e-8f34-490a-9b77-610dacffdbcfn%40googlegroups.com.