Re: [go-nuts] Binary Operators and Generics

2021-10-16 Thread Ian Lance Taylor
On Sat, Oct 16, 2021 at 5:52 PM Leonard Mittmann wrote: > > The Generics proposal does not add the ability to implement binary operators > for types. Instead type sets of language types like `int` or `uint` are > proposed to allow the use of binary operators like `==` or `<` to be used for > ge

[go-nuts] Binary Operators and Generics

2021-10-16 Thread Leonard Mittmann
The Generics proposal does not add the ability to implement binary operators for types. Instead type sets of language types like `int` or `uint` are proposed to allow the use of binary operators like `==` or `<` to be used for generic parameters. Why is this not solved by allowing types to imp

Re: [go-nuts] ast.NewPackage errors for built in types

2021-10-16 Thread Eli Bendersky
On Sat, Oct 16, 2021 at 11:58 AM Steven Hartland wrote: > This is an example of code resulting in ~200ms. > > This was measured on a laptop with i7-7700HQ under WSL2, so that could be > a contributing factor. > > package mypkg > > type MyType struct { > String string > } > On my machine

Re: [go-nuts] ast.NewPackage errors for built in types

2021-10-16 Thread 'Richard Oudkerk' via golang-nuts
I am not sure what "import external packages" means. Apart dot imports (which I have never seen used for real) why would you need to load the imported packages? On Saturday, 16 October 2021 at 20:34:17 UTC+1 Steven Hartland wrote: > Thanks Richard, that allowed me to replace a hand rolled unive

Re: [go-nuts] ast.NewPackage errors for built in types

2021-10-16 Thread Steven Hartland
Thanks Richard, that allowed me to replace a hand rolled universe scope 👍 My importer varies from yours in that for correct lookups for versioned packages or those with '-' in I had to copy ImportPathToAssumedName from x/tools/internal/imports/fix.go. func simpleImporter(imports map[string]*ast.O

[go-nuts] x/crypto/openpgp missing support for uncompressed data in compressed data packets

2021-10-16 Thread 'Aleks Rudzitis' via golang-nuts
Hello, I think I may have found a bug in the x/crypto/openpgp implementation. However, I wanted to ask here to make sure, before filing a bug report. The gist of it is, the RFC for OpenPGP states that "Implementations MUST implement uncompressed data" (source: https://datatracker.ietf.org/doc/

[go-nuts] Re: Clearing sessions

2021-10-16 Thread saro.s...@gmail.com
To add to this a bit, you're using Heroku for hosting and Github actions for CI/CD. In that case, your database connection string is already being provided to you via an environment variable on the Heroku side, specifically DATABASE_URL by default. One reason they do it this way is the case men

Re: [go-nuts] ast.NewPackage errors for built in types

2021-10-16 Thread Steven Hartland
This is an example of code resulting in ~200ms. This was measured on a laptop with i7-7700HQ under WSL2, so that could be a contributing factor. package mypkg type MyType struct { String string } On Sat, 16 Oct 2021 at 14:38, Eli Bendersky wrote: > > > On Fri, Oct 15, 2021 at 2:13 PM

Re: [go-nuts] ast.NewPackage errors for built in types

2021-10-16 Thread 'Richard Oudkerk' via golang-nuts
You could try building the universe scope for ast.NewPackage from types.Universe. For example https://play.golang.org/p/1E5Iu4vW3g9 func NewPackage(fset *token.FileSet, files map[string]*ast.File) (*ast.Package, error) { univ, err := universe() if err != nil { return nil, err } return ast.NewP

Re: [go-nuts] ast.NewPackage errors for built in types

2021-10-16 Thread Eli Bendersky
On Fri, Oct 15, 2021 at 2:13 PM Steven Hartland wrote: > I converted my code to x/tools/go/packages > and while it > did solve the problem it's VERY slow in comparison. > > I have a set of 21 tests operating on a single package which has