Re: [go-nuts] Re: Go 2 error-handling counter-proposal: returnfrom

2018-09-13 Thread roger peppe
What about here, where the call stack associated with g is still live? func g() error { Top: f := func(err error) { returnfrom Top, nil } c := make(chan struct{}) go func() { defer close(c) f(

[go-nuts] Re: Go 2 error-handling counter-proposal: returnfrom

2018-09-13 Thread Scott Pakin
On Thursday, September 13, 2018 at 4:00:28 PM UTC-6, Jonathan Amsterdam wrote: > > What's the meaning of this code? > >func main() { >f := g() >f() > } > >func g() func() { >Top: >return func() { returnfrom Top, nil} >} > It means you're an evil progr

Re: [go-nuts] call of non-function C.testc

2018-09-13 Thread Ian Lance Taylor
On Thu, Sep 13, 2018 at 7:16 PM, wrote: > > Trying to compile the following on Solaris 10 gives the error: call of > non-function C.testc > > package main > > /* > #include > > void testc() { > printf("Hello cgo"); > } > */ > import "C" > > func main() { > C.testc() > } > > The output of

Re: [go-nuts] Ambiguity in generic interfaces

2018-09-13 Thread Ian Lance Taylor
On Thu, Sep 13, 2018 at 6:31 PM, Patrick Smith wrote: > > (Apologies if this has already been brought up; I don't remember seeing it.) > > While writing a bit of sample generics code, I ran into a nasty little > ambiguity: > > type Foo(type T) interface {} > type Bar(type T) interface { > > Foo(T)

[go-nuts] [JOB] Full Stack Engineer @ RADAR ( Portland, Oregon )

2018-09-13 Thread aimeelevensconsulting
Hi all! I'm hiring a Software Engineer (open to midlevel through senior engineers) with strong product development skills to join RADAR's well-established startup in downtown Portland, Oregon. Here's the basics on the role: *As a member of our product software development team, you will collab

[go-nuts] call of non-function C.testc

2018-09-13 Thread amandeep
Trying to compile the following on Solaris 10 gives the error: call of non-function C.testc package main /* #include void testc() { printf("Hello cgo"); } */ import "C" func main() { C.testc() } The output of go env is below: bash-4.3$ go env GOARCH="sparc" GOBIN="" GOCACHE="/expor

Re: [go-nuts] Go memory usage inside containers

2018-09-13 Thread robert engels
I now have the time to give a longer explanation regarding GC, that anyone using Go might find interesting. There are some simplifications in the following, but they’re not significant. At any given moment, the memory use of a program = live objects + garbage + unused heap. When a mutator (app

[go-nuts] Re: http client POST/GET.. will not save cookie before do redirect request

2018-09-13 Thread Rick
I think what people are trying to explain is that the behavior you may be expecting based on experience with browsers is not built in to the Go (or many other) HTTP clients. Even the Java cookie jar which has been mentioned in this thread was not available in early implementations of Java HTTP

[go-nuts] Re: Ambiguity in generic interfaces

2018-09-13 Thread Dave Cheney
I think D solved this quite well https://dlang.org/spec/template.html In your example this might become type Foo(type T) interface {} type Bar(type T) interface { Foo!(T) } The exclamation point makes it clear this is the application of a T to the existing interface type Foo(type T). On Fr

[go-nuts] Ambiguity in generic interfaces

2018-09-13 Thread Patrick Smith
(Apologies if this has already been brought up; I don't remember seeing it.) While writing a bit of sample generics code, I ran into a nasty little ambiguity: type Foo(type T) interface {} type Bar(type T) interface { Foo(T) } Does this embed the interface Foo(T) into Bar(T), or does it add t

[go-nuts] Re: Go 2 error-handling counter-proposal: returnfrom

2018-09-13 Thread Jonathan Amsterdam
What's the meaning of this code? func main() { f := g() f() } func g() func() { Top: return func() { returnfrom Top, nil} } On Thursday, September 13, 2018 at 3:29:03 PM UTC-4, Scott Pakin wrote: > > I recently added to the Go 2 Error Handling Feedback > <

Re: [go-nuts] Why can't we use unicode? [Go2 Generics]

2018-09-13 Thread Wojciech S. Czarnecki
On Thu, 13 Sep 2018 12:16:10 -0700 (PDT) "'Bryan Mills' via golang-nuts" wrote: > Coincidentally, I contribute to a ChromeOS extension that adds XCompose > support,¹ > and I use a similar utility on Windows.² > (I'm not sure what's available on macOS.) https://scripts.sil.org/ukelele > https:/

[go-nuts] Go 2 error-handling counter-proposal: returnfrom

2018-09-13 Thread Scott Pakin
I recently added to the Go 2 Error Handling Feedback page my thoughts on how to improve upon the draft design for error handling : Go 2 error handling b

Re: [go-nuts] Why can't we use unicode? [Go2 Generics]

2018-09-13 Thread 'Bryan Mills' via golang-nuts
Coincidentally, I contribute to a ChromeOS extension that adds XCompose support,¹ and I use a similar utility on Windows.² (I'm not sure what's available on macOS.) ¹ https://github.com/bcmills/extra-keyboards-for-chrome-os/tree/custom-sequences ² https://github.com/samhocevar/wincompose On Frid

Re: [go-nuts] Golang, how dare you handle my checks! (Critique of error proposal)

2018-09-13 Thread Liam Breck
The contents of the feedback wiki are interesting. The Go 2 error proposal hasn't seen much support, and there are lots of counter-proposals... https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback On Mon, Sep 10, 2018, 6:11 AM Liam wrote: > > "Golang, how dare you handle my checks!" > A

[go-nuts] Re: Go 1.11 module cache not safe for concurrent use?

2018-09-13 Thread 'Bryan Mills' via golang-nuts
The module cache and the build cache are separate entities. The build cache is safe for concurrent use. The module cache is not (yet),¹ but you can pre-populate it by running go mod download. ¹ https://golang.org/issue/26794 On Tuesday, August 28, 2018 at 11:01:43 AM UTC-4, Maxim Khitrov wrote

[go-nuts] Craftsman Go Generics proposal updated.

2018-09-13 Thread Wojciech S. Czarnecki
Cleaned and cleared. https://github.com/ohir/gonerics Current state of CGG (TL;DR) * no new keywords. Only ones known to Go1. * contract uses already known Go type definitions and casts. * only one new syntax construct for user, and three for generic code - x.pkg.Method() gen

Re: [go-nuts] Generics - Min challenge

2018-09-13 Thread Manlio Perillo
On Wednesday, September 12, 2018 at 10:56:04 AM UTC+2, ohir wrote: > > On Tue, 11 Sep 2018 18:22:12 -0700 > Patrick Smith > wrote: > > > I'm fairly sure there's no way to write Min, but perhaps someone can > prove > > me wrong? > > Within "Craftsman Go Generics" proposal its trivial: > > func

Re: [go-nuts] variables name and scope

2018-09-13 Thread thepudds1460
Some people strongly recommend always including `-shadow` when running `go vet`. Using your example: $ go vet -shadow # example .\main.go:20: declaration of "p" shadows declaration at .\main.go:15 --thepudds On Thursday, September 13, 2018 at 9:54:05 AM UTC-4, Jan Mercl wrote: > > On

Re: [go-nuts] variables name and scope

2018-09-13 Thread Jan Mercl
On Thu, Sep 13, 2018 at 3:42 PM wrote: > Why Go accepts to have différents variables with the same name ? Is there any good reasons ? Because Go is a block scoped language like C and others: https://en.wikipedia.org/wiki/Scope_(computer_science)#Block_scope -- -j -- You received this messa

[go-nuts] variables name and scope

2018-09-13 Thread gobluescaster
Hi, Why Go accepts to have différents variables with the same name ? Is there any good reasons ? You can spend a lot of time to find a bug like this: package main import ( "fmt" ) func foo() (c int, d int) { c, d = 1, 2 return } func main() { var p int = 7 fmt.Println("p =", p) //

[go-nuts] Is it safe that use a PoW NodeID and S/Kad DHT to replace CA cert in TLS

2018-09-13 Thread Auxten wpc
To implement a decentralized database named CovenantSQL , I wrote a TLS like P2P net stack. The main idea is removing CA Cert from the whole system by using a DHT for Naming and Key Exchange.* I am not a crypto expert, so if there's any flaw please point

Re: [go-nuts] Start an HTTPS server using certificate input from byte content rather than file

2018-09-13 Thread Houzuo Guo
Many thanks Miguel! On Thursday, 13 September 2018 13:33:44 UTC+3, Miguel Angel Rivera Notararigo wrote: > > Hi, you could use a custom tls.Config, see this example ( > https://golang.org/pkg/crypto/tls/#example_X509KeyPair_httpServer) > > On Thu, Sep 13, 2018, 03:49 Houzuo Guo > > wrote: > >> H

Re: [go-nuts] Start an HTTPS server using certificate input from byte content rather than file

2018-09-13 Thread Miguel Angel Rivera Notararigo
Hi, you could use a custom tls.Config, see this example ( https://golang.org/pkg/crypto/tls/#example_X509KeyPair_httpServer) On Thu, Sep 13, 2018, 03:49 Houzuo Guo wrote: > Hello fellow Gophers. > > I'm programming an HTTPS server and PEM-encoded certificate data is given > in bytes rather than

[go-nuts] Start an HTTPS server using certificate input from byte content rather than file

2018-09-13 Thread Houzuo Guo
Hello fellow Gophers. I'm programming an HTTPS server and PEM-encoded certificate data is given in bytes rather than file paths, additionally the data may not touch host file system. However, the public functions of http.Server only accept certificate data in files, and with recently introduce