Re: [go-nuts] SSL socket listener

2020-06-03 Thread Dimas Prawira
Here is an example running server with TLS package main import ( "net/http" "log" ) func HelloServer(w http.ResponseWriter, req *http.Request) { w.Header().Set("Content-Type", "text/plain") w.Write([]byte("This is an example server.\n")) } func main() {

Re: [go-nuts] Assignment of pointer values in a struct...

2020-06-03 Thread Ian Lance Taylor
On Wed, Jun 3, 2020 at 7:33 PM Trig wrote: > > I posted this question the other day and don't see it (may have posted from > another gmail account and it's still pending approval)... so here I am again. > > Let's say I have something like below: > type ( >Person struct { > FirstName

[go-nuts] Assignment of pointer values in a struct...

2020-06-03 Thread Trig
I posted this question the other day and don't see it (may have posted from another gmail account and it's still pending approval)... so here I am again. Let's say I have something like below: type ( Person struct { FirstName *string } ) Usually, I see something like the following

Re: [go-nuts] Re: what is the complexity of regexp.MustCompile()?

2020-06-03 Thread 'Axel Wagner' via golang-nuts
Hi, I can very much recommend reading this list of blog posts by Russ Cox . They explain the theory behind all of this. And AIUI, yes, compilation should also be linear. The cost, notably, is that the regexp package actually can only compile actual regular

Re: [go-nuts] Re: what is the complexity of regexp.MustCompile()?

2020-06-03 Thread Michael Jones
If you have thousands of fixed strings, a map is your friend. Remarkably so. On Wed, Jun 3, 2020 at 2:43 PM Ray Pereda wrote: > Typo fix, regexp#MatchString and > related Match functions are linear. That is an amazing guarantee and makes > regular >

[go-nuts] Re: what is the complexity of regexp.MustCompile()?

2020-06-03 Thread Ray Pereda
Typo fix, regexp#MatchString and related Match functions are linear. That is an amazing guarantee and makes regular expressions 10x more useful than regexps in most other programming languages. Question: Does the *compile* of regular expressions

[go-nuts] what is the complexity of regexp.MustCompile()?

2020-06-03 Thread Ray Pereda
I believe that the complexity of regexp.MustCompile() is linear based on this comment in the regexp package overview. "The regexp implementation provided by this package is guaranteed to run in time

[go-nuts] Multiple freeswitch connections using "github.com/0x19/goesl".!

2020-06-03 Thread David
Hi, I am using goesl wrapper for connecting to single freeswitch ! But i want to connect to multiple freeswitches .! I have used for loop for making connection over array of json objects which works fine. But i want to open connection to multiple connections in parallel and execute my code on

[go-nuts] Re: When "go get" is run in neither a GOPATH directory nor a module-aware directory, should GOPROXY be used or not?

2020-06-03 Thread T L
It looks the default mode in Go 1.14 is still GOPATH mode. So GOPROXY is ignored when "go get" run in neither a GOPATH directory nor a module-aware directory. On Tuesday, June 2, 2020 at 9:12:59 PM UTC-4, T L wrote: > . > -- You received this message because you are subscribed to the Google

Re: [go-nuts] Re: go2go (generics) and function binding

2020-06-03 Thread Sebastien Binet
Ian, ‐‐‐ Original Message ‐‐‐ On Monday, June 1, 2020 5:54 AM, Ian Lance Taylor wrote: > On Sat, May 30, 2020 at 2:32 AM Sebastien Binet d...@sbinet.org wrote: > > > the thing I am trying to solve is, basically, a generic way to: > > > > - pass a function with any number of

Re: [go-nuts] net.go ok function's c != nil check right ?

2020-06-03 Thread apmattil
ooh.. thanks. On Wednesday, June 3, 2020 at 10:21:24 AM UTC+3, kortschak wrote: > > It's perfectly valid to call a method on a nil receiver, so long at the > nil receiver is not dereferenced. > > https://play.golang.org/p/Z-zXlj0-eVy > > > On Wed, 2020-06-03 at 00:03 -0700, apma...@gmail.com

Re: [go-nuts] net.go ok function's c != nil check right ?

2020-06-03 Thread 'Dan Kortschak' via golang-nuts
It's perfectly valid to call a method on a nil receiver, so long at the nil receiver is not dereferenced. https://play.golang.org/p/Z-zXlj0-eVy On Wed, 2020-06-03 at 00:03 -0700, apmat...@gmail.com wrote: > Read function at net.go is like this: > > func (c *conn) Read(b []byte) (int, error) {

[go-nuts] SSL socket listener

2020-06-03 Thread 'Wesley Peng' via golang-nuts
Hello, How do I program with SSL to make a server listen on specific port which accepts SSL transfer only? Is there any guide for this since I have no experience on SSL socket programming. Thanks. Wesley Peng wesleyp...@aol.com -- You received this message because you are subscribed to the

Re: [go-nuts] net.go ok function's c != nil check right ?

2020-06-03 Thread Gregor Best
Methods are part of the type, not of the value. It is perfectly safe to call methods on a nil value. On 03.06.20 09:03, apmat...@gmail.com wrote: Read function at net.go is like this: func (c *conn) Read(b []byte) (int, error) {     if !c.ok() { the ok checks that c is non nil: func (c

[go-nuts] net.go ok function's c != nil check right ?

2020-06-03 Thread apmattil
Read function at net.go is like this: func (c *conn) Read(b []byte) (int, error) { if !c.ok() { the ok checks that c is non nil: func (c *conn) ok() bool { return c != nil && c.fd != nil } how can c ever be nil ? if it would c.ok() call would crash. -- You received this message because