Re: [go-nuts] Which websockets implementation

2022-12-12 Thread 'Christian Stewart' via golang-nuts
I've been using this one w/o issue and at scale as well;

https://github.com/nhooyr/websocket

It also supports wasm.

On Mon, Dec 12, 2022, 1:22 PM Robert Engels  wrote:

> I personally like minimal packages like this. Makes them easier to
> tailor/debug if something goes wrong. Also simpler to take ownership/fork
> if needed - than a package with a ton of code.
>
> On Dec 12, 2022, at 3:14 PM, Amnon  wrote:
>
> By stdlib, you presumably mean the x/net/websocket package, which is
> simple ad has a clean API.
> But it is also frozen, and  has not been updated for 6 years.
> Its docs begin with a deprecation notice:
>
> // This package currently lacks some features found in alternative
> // and more actively maintained WebSocket packages:
> //
> //https://godoc.org/github.com/gorilla/websocket
> //https://godoc.org/nhooyr.io/websocket
>
> https://github.com/golang/net/blob/master/websocket/websocket.go#L8-L12
>
> Should I ignore this notice and go ahead and build my system ontop of
> x/net/websocket?
>
> What would people recommend, if I need a implementation which is robust,
> secure and performant?
>
>
> On Monday, 12 December 2022 at 20:35:59 UTC ren...@ix.netcom.com wrote:
>
>> You can use the stdlib websocket. See
>> https://github.com/robaho/go-trader/blob/master/internal/exchange/webserver.go
>>  for
>> an example.
>>
>> On Dec 12, 2022, at 12:57 PM, Amnon  wrote:
>>
>> Which websocket implementation would people recommend for a new project,
>>
>>
>> now that gorilla/websocket has been archived?
>>
>> --
>> 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/b9bacd1c-62de-4f6f-b249-44464b61cdcen%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/e49c2e82-9dcb-4771-a88b-65585ca330f1n%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/14760CB9-DB67-463B-A69D-81F3F5848FCA%40ix.netcom.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%2Bh8R2rHVs%2BnxxysuLOu9Ab3MCc3LNuiE5B5LUWihQhPDNCaYw%40mail.gmail.com.


Re: [go-nuts] Which websockets implementation

2022-12-12 Thread Robert Engels
I personally like minimal packages like this. Makes them easier to tailor/debug 
if something goes wrong. Also simpler to take ownership/fork if needed - than a 
package with a ton of code. 

> On Dec 12, 2022, at 3:14 PM, Amnon  wrote:
> 
> By stdlib, you presumably mean the x/net/websocket package, which is simple 
> ad has a clean API.
> But it is also frozen, and  has not been updated for 6 years.
> Its docs begin with a deprecation notice:
> 
> // This package currently lacks some features found in alternative
> // and more actively maintained WebSocket packages:
> //
> //https://godoc.org/github.com/gorilla/websocket
> //https://godoc.org/nhooyr.io/websocket
> 
> https://github.com/golang/net/blob/master/websocket/websocket.go#L8-L12
> 
> Should I ignore this notice and go ahead and build my system ontop of 
> x/net/websocket?
> 
> What would people recommend, if I need a implementation which is robust, 
> secure and performant?
> 
>  
>> On Monday, 12 December 2022 at 20:35:59 UTC ren...@ix.netcom.com wrote:
>> You can use the stdlib websocket. See 
>> https://github.com/robaho/go-trader/blob/master/internal/exchange/webserver.go
>>  for an example. 
>> 
 On Dec 12, 2022, at 12:57 PM, Amnon  wrote:
 
>>> Which websocket implementation would people recommend for a new project,
>> 
>>> 
>>> now that gorilla/websocket has been archived?
>> 
>>> -- 
>>> 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/b9bacd1c-62de-4f6f-b249-44464b61cdcen%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/e49c2e82-9dcb-4771-a88b-65585ca330f1n%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/14760CB9-DB67-463B-A69D-81F3F5848FCA%40ix.netcom.com.


Re: [go-nuts] Which websockets implementation

2022-12-12 Thread Amnon
By stdlib, you presumably mean the x/net/websocket package, which is simple 
ad has a clean API.
But it is also frozen, and  has not been updated for 6 years.
Its docs begin with a deprecation notice:

// This package currently lacks some features found in alternative
// and more actively maintained WebSocket packages:
//
//https://godoc.org/github.com/gorilla/websocket
//https://godoc.org/nhooyr.io/websocket

https://github.com/golang/net/blob/master/websocket/websocket.go#L8-L12

Should I ignore this notice and go ahead and build my system ontop of 
x/net/websocket?

What would people recommend, if I need a implementation which is robust, 
secure and performant?

 
On Monday, 12 December 2022 at 20:35:59 UTC ren...@ix.netcom.com wrote:

> You can use the stdlib websocket. See 
> https://github.com/robaho/go-trader/blob/master/internal/exchange/webserver.go
>  for 
> an example. 
>
> On Dec 12, 2022, at 12:57 PM, Amnon  wrote:
>
> Which websocket implementation would people recommend for a new project,
>
>
> now that gorilla/websocket has been archived? 
>
> -- 
> 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/b9bacd1c-62de-4f6f-b249-44464b61cdcen%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/e49c2e82-9dcb-4771-a88b-65585ca330f1n%40googlegroups.com.


Re: [go-nuts] Shellquote in stdlib

2022-12-12 Thread Martin Atkins
I don't think the Go command is using a shell to parse the value of the 
-gcflags option.

I believe that the syntax for this option is handled by an internal 
function called quoted.Split 
,
 
which defines its own syntax for quoting. The result is a slice of string 
ready to be included as part of the arguments to another command, without 
any intermediate shell evaluation.

If that *is* the syntax gcflags is using (which I'm not 100% sure about), 
then you can find a corresponding function Join in that same source file 
which performs the opposite operation: encoding a slice of string as a 
single string. It's an internal package and so you can't depend on it 
directly from your program, but its implementation is small so presumably 
you could copy it into your own program.


On Wednesday, November 23, 2022 at 5:09:45 PM UTC-8 chri...@aperture.us 
wrote:

> Hi Kurtis,
>
>
> On Wed, Nov 23, 2022, 4:57 PM Kurtis Rader  wrote:
>
>> On Wed, Nov 23, 2022 at 7:33 AM Christian Stewart  
>> wrote:
>>
>>> This is what I'm trying to accomplish:
>>>
>>> Start delve (dlv) with os/exec passing a set of []string os.Args as
>>> --build-flags
>>>
>>> Let's say I have this build arguments set: []string{"-gcflags", "-N -l"}
>>>
>>>  - How can I pass this to --build-flags in Delve? strings.Join(flags,
>>> " ") is wrong.
>>>
>>
>> Note that there are two levels of quoting involved in your example and a 
>> package that does "shell quoting" isn't going to handle this scenario 
>> correctly except for uninteresting trivial cases.
>>
>
> Please explain?
>
>
>>  - How can I pass this to "go" with os/exec correctly? The quotes are
>>> not put properly.
>>>
>>
>> I'm not sure I understand that question. If you're asking how to run `go 
>> -gcflags="-N -l"` via a program written in Go the answer is to call os.exec 
>> with the literal string "-gcflags=-N -l" as an argument. Note that if you 
>> execute the `go` command directly, rather than indirectly via a shell, you 
>> don't need quotes around the "-N -l" portion of that string since a shell 
>> isn't parsing the command. 
>>
>
> That doesn't work, from my tests
>
> This is why you should avoid running external commands indirectly through 
>> a shell. Doing so greatly, and usually needlessly, complicates constructing 
>> the command to be run.
>>  
>>
>>> There are some cross-platform cases where the shell quoting is used,
>>> and the general "quote something" mechanics are similar on Windows and
>>> Linux.
>>>
>>
>> Similar is not the same as identical. The rules for how quoted strings, 
>> and other punctuation, are handled differs enough that only trivial, 
>> uninteresting, cases are likely to work correctly on both platforms. Heck, 
>> even on UNIX like systems if the user has set their login shell to a 
>> non-POSIX shell (like Fish or Elvish) and your code uses the login shell 
>> rather than something like /bin/sh you will be in for a surprise. :-)
>>
>
> I'm not calling out to the shell, just passing args to another process 
> that expects them to be shell quoted. 
>
> Thanks,
> Christian
>

-- 
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/fd94f862-b51f-4746-aa82-3c618ed2e7f8n%40googlegroups.com.


Re: [go-nuts] Which websockets implementation

2022-12-12 Thread Robert Engels
You can use the stdlib websocket. See 
https://github.com/robaho/go-trader/blob/master/internal/exchange/webserver.go 
for an example. 

> On Dec 12, 2022, at 12:57 PM, Amnon  wrote:
> 
> Which websocket implementation would people recommend for a new project,
> now that gorilla/websocket has been archived?
> -- 
> 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/b9bacd1c-62de-4f6f-b249-44464b61cdcen%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/BF23BFDC-6A1F-4C0C-8497-77D94DABACBE%40ix.netcom.com.


Re: [go-nuts] CRC32C with seed value

2022-12-12 Thread Mike Campin
Shouldn't the polynomial be 0x1EDC6F41 instead of 0x1EDC6F1

On Saturday, July 11, 2015 at 10:18:15 AM UTC-7 Joe Poirier wrote:

> On Sat, Jul 11, 2015 at 10:25 AM, Akira Hayakawa  
> wrote:
>
>> Hi,
>>
>> I am at loss how I can compute crc32c hash value with given seed.
>>
>> Some C libraries including Linux kernel's libcrc32c has API that takes 
>> three arguments: seed(uint32), data(void *) and the length(int). So the 
>> same design in Go's crc32 library helps users import their C programs to 
>> Go. Actually, I need the API.
>>
>> I tried crc32.Update(seed, Castagnoli table, data) but the computed value 
>> differs from what I compute with Linux's libcrc32c.
>>
>> I am not expertise in crc32c algorithm but I am just a user. So I think I 
>> should ask you how to make the same thing as libcrc32c using Go's crc32 
>> library.
>>
>>
>>
>>
>> crc32c uses polynomial 0x1EDC6F1 (reversed 0x82F63B78). So from 
> src/hash/example_test.go (replace 0xD5828281 with 0x82F63B78):
>
> package crc32_test
>
> import (
> "fmt"
> "hash/crc32"
> )
>
> func ExampleMakeTable() {
> // In this package, the CRC polynomial is represented in reversed 
> notation,
> // or LSB-first representation.
> //
> // LSB-first representation is a hexadecimal number with n bits, in 
> which the
> // most significant bit represents the coefficient of x⁰ and the least 
> significant
> // bit represents the coefficient of xⁿ⁻¹ (the coefficient for xⁿ is 
> implicit).
> //
> // For example, CRC32-Q, as defined by the following polynomial,
> //x³²+ x³¹+ x²⁴+ x²²+ x¹⁶+ x¹⁴+ x⁸+ x⁷+ x⁵+ x³+ x¹+ x⁰
> // has the reversed notation 0b11010101101010101001, so 
> the value
> // that should be passed to MakeTable is 0xD5828281.
> crc32q := crc32.MakeTable(0xD5828281)
> fmt.Printf("%08x\n", crc32.Checksum([]byte("Hello world"), crc32q))
> // Output:
> // 2964d064
> }
>
> See more test examples in src/hash/crc32_test.go
>
> *Note, 0x82F63B78 is exported from src/hash/crc32.go as a constant via 
> crc32.Castagnoli
>

-- 
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/90f76496-51f9-4511-a96b-fb8bde8af9cen%40googlegroups.com.


[go-nuts] Which websockets implementation

2022-12-12 Thread Amnon
Which websocket implementation would people recommend for a new project,
now that gorilla/websocket has been archived?

-- 
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/b9bacd1c-62de-4f6f-b249-44464b61cdcen%40googlegroups.com.


Re: [go-nuts] Chromebook golang environment?

2022-12-12 Thread Robert Engels
You can also use remote VMs like GCP to run VSCode. Chrome book works for that. 

> On Dec 12, 2022, at 8:54 AM, Bruno Albuquerque  wrote:
> 
> If you just mean being able to write Go programs in a Chromebook, most
> recent ones have Linux support so you can just use that.
> 
>> On Mon, Dec 12, 2022 at 2:59 AM Ken  wrote:
>> 
>> Hi, does a golang dev environment exist for Chromebook computers?
>> 
>> Sent from my iPhone
>> 
>> --
>> 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/7B01FAC5-59A0-44CF-83B7-17F3F25C9675%40gmail.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/CAEd86TwxXv0zMmSrr9A2QrWeefgy%2BM7wjx3c_gwVg2_TKFz2pw%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/F5BF2E41-8D44-4E50-AFA1-2B7C5C232E53%40ix.netcom.com.


Re: [go-nuts] Chromebook golang environment?

2022-12-12 Thread Bruno Albuquerque
If you just mean being able to write Go programs in a Chromebook, most
recent ones have Linux support so you can just use that.

On Mon, Dec 12, 2022 at 2:59 AM Ken  wrote:
>
> Hi, does a golang dev environment exist for Chromebook computers?
>
> Sent from my iPhone
>
> --
> 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/7B01FAC5-59A0-44CF-83B7-17F3F25C9675%40gmail.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/CAEd86TwxXv0zMmSrr9A2QrWeefgy%2BM7wjx3c_gwVg2_TKFz2pw%40mail.gmail.com.


[go-nuts] Re: Hide Golang Code from Exported package

2022-12-12 Thread Brian Candler
Distribute your library as a grpc server.
https://github.com/hashicorp/go-plugin

On Monday, 12 December 2022 at 07:56:52 UTC nsing...@gmail.com wrote:

> Actually i need to share it as an sdk. So any way i can share
>
> On Thursday, December 8, 2022 at 1:13:17 PM UTC+5:30 marc...@gmail.com 
> wrote:
>
>> if you produce an executable, nobody sees the actual Go code.
>> build it with:
>> go build -ldflags "-s -w"
>>
>> or you could try to obfuscate it:
>> https://github.com/burrowers/garble
>>
>> or you can make a self-extracting executable
>>
>>
>> Op woensdag 7 december 2022 om 19:09:31 UTC+1 schreef nsing...@gmail.com:
>>
>>> Hi All,
>>> We are looking for a way to distribute a Golang Package. but We ant to 
>>> hide the Code which we have written. 
>>> We went Through Creating A DLL to distribute but it crashes at different 
>>> point while running. As we have distribute to Both linux and windows . And 
>>> i found that for linux we can use plugin. But the crash for windows dll  
>>> after importing the file is concerning for us and its happening at random 
>>> points in the code also "bad sweepgen in refill".  
>>> If there is any other way to distribute the code without showing the 
>>> source code please Tell
>>> Thanks
>>> Neeraj
>>>
>>

-- 
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/00731714-8816-4af5-92ac-668d3c4ed4dcn%40googlegroups.com.